Closed Bug 1159824 Opened 10 years ago Closed 8 years ago

Context Menu Broken (returning undefined variables in ContextScript) using FF38 and JPM

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: cplantijn90, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0 Build ID: 20150427090451 Steps to reproduce: Below is the code ran in index.js 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 const cm = require("sdk/context-menu"); var selectItem = cm.Item({ label: "Call", image: self.data.url("img/context-icon-42.png"), context: cm.SelectionContext(), contentScript: 'self.on("context", function(e) {' + 'console.log(e);' + ' var usrSelection = window.getSelection().toString();' + ' if (usrSelection.length > 20)' + ' usrSelection = usrSelection.substr(0, 20) + "...";' + ' return "Call " + usrSelection;' + '});' + 'self.on("click", function(){' + ' self.postMessage(window.getSelection().toString());' + '});', onMessage: function(selection){ var payload = { "request" : "userSelectionDialOut", "destination" : selection }; frame.postMessage(payload, frame.url); } }); Actual results: Error received in console 13:43:34.356 TypeError: addonInfo is undefined Stack trace: hasMatchingContext@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js:311:11 isItemVisible@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js:330:8 setVisibility@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js:789:21 updateItemVisibilities@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js:1019:7 1 context-menu.js:1022 Expected results: Script should accurately run
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.