mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1137591 part 2. Throw if someone does Cu.importGlobalProperties in a Window scope. r=bholley
This commit is contained in:
parent
84cb117bc7
commit
b3a7aa44f6
@ -17,7 +17,6 @@
|
||||
|
||||
const { 'utils': Cu } = Components;
|
||||
Cu.import("resource://gre/modules/ContactDB.jsm", window);
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
|
||||
let contactsDB = new ContactDB();
|
||||
contactsDB.init();
|
||||
|
@ -142,7 +142,6 @@
|
||||
|
||||
const { 'utils': Cu } = Components;
|
||||
Cu.import("resource://gre/modules/ContactDB.jsm", window);
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
|
||||
let cdb = new ContactDB();
|
||||
cdb.init();
|
||||
|
@ -10,8 +10,6 @@ let testGenerator = testSteps();
|
||||
if (!window.runTest) {
|
||||
window.runTest = function()
|
||||
{
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
testGenerator.next();
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mozilla/dom/DOMExceptionBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#include "nsZipArchive.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIDOMFileList.h"
|
||||
@ -2719,6 +2720,13 @@ nsXPCComponents_Utils::ImportGlobalProperties(HandleValue aPropertyList,
|
||||
{
|
||||
RootedObject global(cx, CurrentGlobalOrNull(cx));
|
||||
MOZ_ASSERT(global);
|
||||
|
||||
// Don't allow doing this if the global is a Window
|
||||
nsGlobalWindow* win;
|
||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(Window, global, win))) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
GlobalProperties options;
|
||||
NS_ENSURE_TRUE(aPropertyList.isObject(), NS_ERROR_INVALID_ARG);
|
||||
RootedObject propertyList(cx, &aPropertyList.toObject());
|
||||
|
@ -19,7 +19,9 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["File"]);
|
||||
if (!this.File) {
|
||||
Cu.importGlobalProperties(["File"]);
|
||||
}
|
||||
|
||||
// Allow stuff from this scope to be accessed from non-privileged scopes. This
|
||||
// would crash if used outside of automation.
|
||||
|
@ -15,7 +15,6 @@ Cu.import("resource://gre/modules/devtools/Loader.jsm");
|
||||
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
|
||||
const {CssLogic} = devtools.require("devtools/styleinspector/css-logic");
|
||||
Cu.importGlobalProperties(['CSS']);
|
||||
|
||||
window.onload = function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
Loading…
Reference in New Issue
Block a user