Closed Bug 936917 Opened 11 years ago Closed 11 years ago

Places API doesn't work for mobile version

Categories

(Add-on SDK Graveyard :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 892181

People

(Reporter: shweta.universidad, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0 (Beta/Release) Build ID: 20131028113246 Steps to reproduce: I am learning to how to make an addon on firefox for mobile. I have already made the desktop version and I wanted to adapt it for the mobile version. The following code is just for test: lib/main.js const {Ci,Cc} = require("chrome"); var history = require('./module.js'); var menuId; function loadIntoWindow(window) { if (!window) return; menuId = window.NativeWindow.menu.add("Show Toast", null, function() { showDoorhanger(window); window.alert("HISTORY"); }); let label = "Show HTML"; let selector = window.NativeWindow.contextmenus.SelectorContext("*"); menuID = window.NativeWindow.contextmenus.add(label, selector, function(target) { window.NativeWindow.toast.show(target.outerHTML, "short"); }); // DO SOMETHING HERE (create UI) } function showDoorhanger(aWindow) { buttons = [ { label: "Button 1", callback: function() { aWindow.NativeWindow.toast.show("Button 1 was tapped", "short"); } } , { label: "Button 2", callback: function() { aWindow.NativeWindow.toast.show("Button 2 was tapped", "short"); } }]; aWindow.NativeWindow.doorhanger.show("Showing a doorhanger with two button choices.", "doorhanger-test", buttons); } var windowListener = { onOpenWindow: function(aWindow) { // Wait for the window to finish loading let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow); domWindow.addEventListener("load", function onLoad() { domWindow.removeEventListener("load", onLoad, false); loadIntoWindow(domWindow); }, false); }, onCloseWindow: function(aWindow) {}, onWindowTitleChange: function(aWindow, aTitle) {} }; /*function showMsg(MSG){ MSG[0].alert(MSG[1]); }*/ function startup() { let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); // Load into any existing windows let windows = wm.getEnumerator("navigator:browser"); while (windows.hasMoreElements()) { let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow); loadIntoWindow(domWindow); } // Load into any new windows wm.addListener(windowListener); } function showToast(aWindow,msg) { aWindow.NativeWindow.toast.show(msg, "short"); } exports.main = function(options, callbacks) { startup(); } lib/module.js: const {Ci,Cc} = require("chrome"); var { emit, on, once, off } = require("sdk/event/core"); exports.on = on.bind(null, exports); exports.once = once.bind(null, exports); exports.removeListener = function removeListener(type, listener) { off(exports, type, listener); }; var historyService = Cc["@mozilla.org/browser/nav-history-service;1"]..getService(Ci.nsINavHistoryService); //Do something with the historyService Actual results: If I include the module.js , the whole code doesn't work because I think the line: > var historyService = Cc["@mozilla.org/browser/nav-history-service;1"]..getService(Ci.nsINavHistoryService); doesn't work for the mobile version. Expected results: It should have worked because with the desktop version addon it works perfectly. How can I get the bookmark and history query for the mobile version? Another question: Is there any way to know if the bookmark panel has been opened? I would like to show a menu item when the bookmark context menu is shown (The one when you go to the bookmark tab and tap on for a while on a bookmark and appears a context menu ). Thanks
Product: Firefox for Android → Add-on SDK
Version: Firefox 25 → unspecified
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.