TypeError: property 'sandbox[key]' is non-configurable and cannot be deleted (jetpack-core-lib/content/worker.js:236)

RESOLVED FIXED

Status

Add-on SDK
General
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Nickolay_Ponomarev, Assigned: irakli)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
$ cat lib/main.js

exports.main = function() {
  var page = require("page-worker").Page({
    contentURL: "chrome://global/content/buildconfig.html",
    contentScript: "postMessage(document.querySelectorAll('h2 + p > a')[0].href)",
    contentScriptWhen: "ready",
    onMessage: function(message) {
      console.log("message");
    }
  });
  require("page-worker").add(page);
};

$ cfx run -a firefox -b /Applications/Minefield.app

Then when quitting Minefield, the following message is printed to console:

TypeError: property 'sandbox[key]' is non-configurable and cannot be deleted (resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/securable-module.js -> resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/content/worker.js:237)
stack:
_destructor()@resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/securable-module.js -> resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/content/worker.js:237
_emit("unload")@resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/securable-module.js -> resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/events.js:142
_deconstructWorker("shutdown")@resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/securable-module.js -> resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/content/worker.js:344
(_deconstructWorker,0,[object Array])@resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/securable-module.js -> resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/unload.js:14
send("shutdown")@resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/securable-module.js -> resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/unload.js:13
unloadLoader("shutdown")@resource://jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack-core-lib/cuddlefish.js:79
Harness_unload("shutdown")@resource://gre/modules/XPIProvider.jsm -> file:///var/folders/Mm/MmHGbDXZHGqXIK97vgbSaU+++TI/-Tmp-/tmpBi0zOe.mozrunner/extensions/xulapp@toolness.com/bootstrap.js -> file:///var/folders/Mm/MmHGbDXZHGqXIK97vgbSaU+++TI/-Tmp-/tmpBi0zOe.mozrunner/extensions/xulapp@toolness.com/components/harness.js:376
Harness_observe(null,"quit-application-granted",null)@resource://gre/modules/XPIProvider.jsm -> file:///var/folders/Mm/MmHGbDXZHGqXIK97vgbSaU+++TI/-Tmp-/tmpBi0zOe.mozrunner/extensions/xulapp@toolness.com/bootstrap.js -> file:///var/folders/Mm/MmHGbDXZHGqXIK97vgbSaU+++TI/-Tmp-/tmpBi0zOe.mozrunner/extensions/xulapp@toolness.com/components/harness.js:411
goQuitApplication()@chrome://global/content/globalOverlay.js:40
oncommand([object XULCommandEvent])@chrome://browser/content/hiddenWindow.xul:1

If I add logging to the function in question:

  _destructor: function _destructor() {
    this._removeAllListeners();
    let publicAPI = this._public,
        sandbox = this._sandbox;
    delete sandbox.__proto__;
    for (let key in publicAPI) {
      console.log(key) // <--
      delete sandbox[key];
    }

I see these before the error:
info: message
info: on
info: setTimeout
info: clearTimeout
info: setInterval
info: clearInterval
info: onMessage

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0b7pre) Gecko/20100918 Firefox/4.0b7pre
(Reporter)

Comment 1

8 years ago
Oh, and this is jetpack tip, http://hg.mozilla.org/labs/jetpack-sdk/rev/0754e897a883
This is something that came up after changes in js engine, but this patch takes care of this issue as well:

https://bugzilla.mozilla.org/show_bug.cgi?id=596666
Depends on: 596666
Assignee: nobody → rFobic
Fixed by the fix for bug 596666.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.