SDK/JPM - window.getSelection error when requiring selection

RESOLVED DUPLICATE of bug 1060695

Status

Add-on SDK
General
RESOLVED DUPLICATE of bug 1060695
3 years ago
3 years ago

People

(Reporter: Thomas Andersen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
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.
Blocks: 1093385
Should be fixed in today's nightly
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1060138
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
Last Resolved: 3 years ago3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1060695
You need to log in before you can comment on or make changes to this bug.