From 1ad5aa5b655f33c9710d288486269634c7103313 Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Tue, 10 Jun 2014 20:35:51 +0200 Subject: [PATCH] Bug 1003905 - Refactor DevToolsUtils.js to be worker friendly; r=past --- toolkit/devtools/DevToolsUtils.js | 6 ++++++ toolkit/devtools/worker-loader.js | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/toolkit/devtools/DevToolsUtils.js b/toolkit/devtools/DevToolsUtils.js index edec0362cbc..a9ea7077887 100644 --- a/toolkit/devtools/DevToolsUtils.js +++ b/toolkit/devtools/DevToolsUtils.js @@ -290,6 +290,12 @@ exports.hasSafeGetter = function hasSafeGetter(aDesc) { * True if it is safe to read properties from aObj, or false otherwise. */ exports.isSafeJSObject = function isSafeJSObject(aObj) { + // If we are running on a worker thread, Cu is not available. In this case, + // we always return false, just to be on the safe side. + if (!Cu) { + return false; + } + if (Cu.getGlobalForObject(aObj) == Cu.getGlobalForObject(exports.isSafeJSObject)) { return true; // aObj is not a cross-compartment wrapper. diff --git a/toolkit/devtools/worker-loader.js b/toolkit/devtools/worker-loader.js index 13b4fafc9b1..e42b4da8e2b 100644 --- a/toolkit/devtools/worker-loader.js +++ b/toolkit/devtools/worker-loader.js @@ -102,7 +102,6 @@ function createModule(id) { // // TODO: Remove this when the whitelist becomes empty let chromeWhitelist = [ - "devtools/toolkit/DevToolsUtils", "devtools/toolkit/event-emitter", ];