From f13acce374e9b53d171024c13af7ea506a58191e Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Wed, 19 Nov 2014 02:48:22 -0500 Subject: [PATCH] Bug 1089811 - remove nsIDOMGlobalObjectConstructor because it is dead code r=bz --- dom/base/nsDOMClassInfo.cpp | 60 ------------------- dom/interfaces/base/moz.build | 1 - .../base/nsIDOMGlobalObjectConstructor.idl | 19 ------ 3 files changed, 80 deletions(-) delete mode 100644 dom/interfaces/base/nsIDOMGlobalObjectConstructor.idl diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index d489bccc3ec..3b3aee9534c 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -108,7 +108,6 @@ #include "FMRadio.h" #endif -#include "nsIDOMGlobalObjectConstructor.h" #include "nsDebug.h" #include "mozilla/dom/BindingUtils.h" @@ -1351,65 +1350,6 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner, return rv; } - nsCOMPtr constructor(do_QueryInterface(native)); - if (constructor) { - // Initialize object using the current inner window, but only if - // the caller can access it. - nsCOMPtr owner = do_QueryReferent(aWeakOwner); - nsPIDOMWindow* outerWindow = owner ? owner->GetOuterWindow() : nullptr; - nsPIDOMWindow* currentInner = - outerWindow ? outerWindow->GetCurrentInnerWindow() : nullptr; - if (!currentInner || - (owner != currentInner && - !nsContentUtils::CanCallerAccess(currentInner))) { - return NS_ERROR_DOM_SECURITY_ERR; - } - - nsCOMPtr wrappedJS = do_QueryInterface(native); - - JS::Rooted thisObject(cx, wrappedJS->GetJSObject()); - if (!thisObject) { - return NS_ERROR_UNEXPECTED; - } - - JSAutoCompartment ac(cx, thisObject); - - JS::Rooted funval(cx); - if (!JS_GetProperty(cx, thisObject, "constructor", &funval) || - !funval.isObject()) { - return NS_ERROR_UNEXPECTED; - } - - // Check if the object is even callable. - NS_ENSURE_STATE(JS::IsCallable(&funval.toObject())); - { - // wrap parameters in the target compartment - // we also pass in the calling window as the first argument - unsigned argc = args.length() + 1; - JS::AutoValueVector argv(cx); - if (!argv.resize(argc)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr currentWin(do_GetInterface(currentInner)); - rv = WrapNative(cx, currentWin, &NS_GET_IID(nsIDOMWindow), - true, argv[0]); - - for (size_t i = 1; i < argc; ++i) { - argv[i].set(args[i - 1]); - if (!JS_WrapValue(cx, argv[i])) - return NS_ERROR_FAILURE; - } - - JS::Rooted frval(cx); - bool ret = JS_CallFunctionValue(cx, thisObject, funval, argv, &frval); - - if (!ret) { - return NS_ERROR_FAILURE; - } - } - } - js::AssertSameCompartment(cx, obj); return WrapNative(cx, native, true, args.rval()); } diff --git a/dom/interfaces/base/moz.build b/dom/interfaces/base/moz.build index c1422f6e69d..20ae0d05f46 100644 --- a/dom/interfaces/base/moz.build +++ b/dom/interfaces/base/moz.build @@ -17,7 +17,6 @@ XPIDL_SOURCES += [ 'nsIDOMClientRectList.idl', 'nsIDOMConstructor.idl', 'nsIDOMCrypto.idl', - 'nsIDOMGlobalObjectConstructor.idl', 'nsIDOMGlobalPropertyInitializer.idl', 'nsIDOMHistory.idl', 'nsIDOMJSWindow.idl', diff --git a/dom/interfaces/base/nsIDOMGlobalObjectConstructor.idl b/dom/interfaces/base/nsIDOMGlobalObjectConstructor.idl deleted file mode 100644 index 6d49efdcb76..00000000000 --- a/dom/interfaces/base/nsIDOMGlobalObjectConstructor.idl +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "domstubs.idl" - -[scriptable, uuid(cb439c73-0129-4289-a349-c5216e6b912a)] -interface nsIDOMGlobalObjectConstructor : nsISupports -{ - /* - * JS use only - * - * The constructor() method will be called with any parameters passed - * to the object constructor. - * If the JS implementation returns a value, it will be ignored. - */ - void constructor(); -};