Bug 1233497 - Temporarily allow unsafe CPOWs in Promise-backend.js and Task.jsm. r?billm draft
authorMike Conley <mconley@mozilla.com>
Mon, 18 Jan 2016 12:44:37 -0500
changeset 322534 bb9970905d1890965e739e2ce405273455b64084
parent 322533 8bee7a33bf9942416bb4001c7243fcae5be4a486
child 322535 d14ae87795fb63293e4e3cee855ac25e2d066fcd
push id9629
push usermconley@mozilla.com
push dateMon, 18 Jan 2016 22:25:49 +0000
reviewersbillm
bugs1233497
milestone46.0a1
Bug 1233497 - Temporarily allow unsafe CPOWs in Promise-backend.js and Task.jsm. r?billm
toolkit/modules/Promise-backend.js
toolkit/modules/Task.jsm
--- a/toolkit/modules/Promise-backend.js
+++ b/toolkit/modules/Promise-backend.js
@@ -51,16 +51,20 @@ var Components_ = this.require ? require
 // If Cu is defined, use it to lazily define the FinalizationWitnessService.
 if (Cu) {
   Cu.import("resource://gre/modules/Services.jsm");
   Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
   XPCOMUtils.defineLazyServiceGetter(this, "FinalizationWitnessService",
                                      "@mozilla.org/toolkit/finalizationwitness;1",
                                      "nsIFinalizationWitnessService");
+
+  // For now, we're worried about add-ons using Promises with CPOWs, so we'll
+  // permit them in this scope, but this support will go away soon.
+  Cu.permitCPOWsInScope(this);
 }
 
 const STATUS_PENDING = 0;
 const STATUS_RESOLVED = 1;
 const STATUS_REJECTED = 2;
 
 // This N_INTERNALS name allow internal properties of the Promise to be
 // accessed only by this module, while still being visible on the object
--- a/toolkit/modules/Task.jsm
+++ b/toolkit/modules/Task.jsm
@@ -86,16 +86,20 @@ this.EXPORTED_SYMBOLS = [
 ////////////////////////////////////////////////////////////////////////////////
 //// Globals
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
+// For now, we're worried about add-ons using Tasks with CPOWs, so we'll
+// permit them in this scope, but this support will go away soon.
+Cu.permitCPOWsInScope(this);
+
 Cu.import("resource://gre/modules/Promise.jsm");
 
 // The following error types are considered programmer errors, which should be
 // reported (possibly redundantly) so as to let programmers fix their code.
 const ERRORS_TO_REPORT = ["EvalError", "RangeError", "ReferenceError", "TypeError"];
 
 /**
  * The Task currently being executed