Closed Bug 1099042 Opened 10 years ago Closed 10 years ago

SDK/JPM - window.getSelection error when requiring selection

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1060695

People

(Reporter: thomas, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20141113004001

Steps to reproduce:

Using JPM and Nightly 36.0a1 (2014-11-13).

jpm -V = 0.0.17
cfx --version = Add-on SDK firefox-24-06-12-2013-1365-gf1fed2c (f1fed2c95c877d195f416c4f02517345f975255b)

1. Create a new addon using jpm
2. In index.js add this snippet:

require("sdk/context-menu").Item({
  label: "This Page Has Images",
  contentScript: 'self.on("context", function (node) {' +
                 '  return !!document.querySelector("img");' +
                 '});'
});

3. Run the addon,  jpm run -b nightly.



Actual results:

I get this message in the terminal:

Full message: TypeError: window.getSelection is not a function
Full stack: addSelectionListener@resource://gre/modules/commonjs/sdk/selection.js:345:19
@resource://gre/modules/commonjs/sdk/selection.js:409:1
@resource://gre/modules/commonjs/sdk/context-menu.js:28:19
@resource://gfycat-companion-for-firefox-4/index.js:10:10
run@resource://gre/modules/commonjs/sdk/addon/runner.js:145:19
startup/</<@resource://gre/modules/commonjs/sdk/addon/runner.js:86:7
Handler.prototype.process@resource://gre/modules/Promise-backend.js:868:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:747:7

and the menu item is never shown.


Expected results:

No error message and I should see the context menu item in the context menu.
Should be fixed in today's nightly
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
I still get this when I run `jpm run -b nightly -v` on https://github.com/mozilla/addon-sdk/tree/master/test/addons/private-browsing-supported
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
Summary: SDK/JPM - window.getSelection error when requiring context-menu → SDK/JPM - window.getSelection error when requiring selection
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.