Closed Bug 1068959 Opened 10 years ago Closed 9 years ago

page-mod attachTo gives an error with jpm

Categories

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

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: wbamberg, Unassigned)

References

Details

Originally reported in the forum: https://forums.mozilla.org/addons/viewtopic.php?f=27&t=20143

With a package.json like this:

{
  "name": "attachto-cfx",
  "title": "attachto-cfx",
  "id": "jid1-Dq4dD4t9AwKUMA@jetpack",
  "description": "a basic add-on",
  "author": "",
  "license": "MPL 2.0",
  "version": "0.1",
  "main" : "lib/main.js"
}

... and a main.js like this:

prefsMod = require("sdk/page-mod").PageMod({
   include: "*",
   contentScript: "window.alert('here i am');",
   contentScriptWhen: "start",
   attachTo: ["existing", "top"]
});

...and a command like this:

jpm run -b nightly

...I sometimes, but not always, get an error like this:

JPM error *************************
A coding exception was thrown in a Promise resolution callback.
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Full message: TypeError: getTabBrowser(...) is null
Full stack: getTabContainer@resource://gre/modules/commonjs/sdk/tabs/utils.js:70:10
getTabs@resource://gre/modules/commonjs/sdk/tabs/utils.js:95:23
getTabs/<@resource://gre/modules/commonjs/sdk/tabs/utils.js:87:53
getTabs@resource://gre/modules/commonjs/sdk/tabs/utils.js:85:1
applyOnExistingDocuments@resource://gre/modules/commonjs/sdk/page-mod.js:190:3
PageMod@resource://gre/modules/commonjs/sdk/page-mod.js:149:7
@resource://gre/modules/commonjs/sdk/core/disposable.js:48:56
dispatch@resource://gre/modules/commonjs/method/core.js:119:12
Disposable<.initialize@resource://gre/modules/commonjs/sdk/core/disposable.js:69:17
constructor@resource://gre/modules/commonjs/sdk/core/heritage.js:145:23
@resource://jid1-dq4dd4t9awkuma-at-jetpack/lib/main.js:1:12
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:865:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:744:7

*************************
console.error: attachto-cfx: 
  Message: TypeError: getTabBrowser(...) is null
  Stack:
    getTabContainer@resource://gre/modules/commonjs/sdk/tabs/utils.js:70:10
getTabs@resource://gre/modules/commonjs/sdk/tabs/utils.js:95:23
getTabs/<@resource://gre/modules/commonjs/sdk/tabs/utils.js:87:53
getTabs@resource://gre/modules/commonjs/sdk/tabs/utils.js:85:1
applyOnExistingDocuments@resource://gre/modules/commonjs/sdk/page-mod.js:190:3
PageMod@resource://gre/modules/commonjs/sdk/page-mod.js:149:7
@resource://gre/modules/commonjs/sdk/core/disposable.js:48:56
dispatch@resource://gre/modules/commonjs/method/core.js:119:12
Disposable<.initialize@resource://gre/modules/commonjs/sdk/core/disposable.js:69:17
constructor@resource://gre/modules/commonjs/sdk/core/heritage.js:145:23
@resource://jid1-dq4dd4t9awkuma-at-jetpack/lib/main.js:1:12
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:865:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:744:7

I don't get the same error using cfx:

cfx run -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
Erik this sounds similar to issue you've mentioned before that I believe was fixed. Would you please mind taking a look at this one as well and see if it's related ?
Assignee: nobody → evold
Priority: -- → P1
I wanted to try to take a look at this, but I'm not sure that I will be able to now.
Assignee: evold → nobody
We run the page-mod tests with jpm now on travis so this should work.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Blocks: jpm, sdk/page-mod
OS: Mac OS X → All
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.