Bug 1089811 - remove nsIDOMGlobalObjectConstructor because it is dead code r=bz

This commit is contained in:
David Zbarsky 2014-11-19 02:48:22 -05:00
Родитель 31b5e57828
Коммит 856e7191b0
3 изменённых файлов: 0 добавлений и 80 удалений

Просмотреть файл

@ -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<nsIDOMGlobalObjectConstructor> constructor(do_QueryInterface(native));
if (constructor) {
// Initialize object using the current inner window, but only if
// the caller can access it.
nsCOMPtr<nsPIDOMWindow> 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<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(native);
JS::Rooted<JSObject*> thisObject(cx, wrappedJS->GetJSObject());
if (!thisObject) {
return NS_ERROR_UNEXPECTED;
}
JSAutoCompartment ac(cx, thisObject);
JS::Rooted<JS::Value> 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<nsIDOMWindow> 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<JS::Value> 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());
}

Просмотреть файл

@ -17,7 +17,6 @@ XPIDL_SOURCES += [
'nsIDOMClientRectList.idl',
'nsIDOMConstructor.idl',
'nsIDOMCrypto.idl',
'nsIDOMGlobalObjectConstructor.idl',
'nsIDOMGlobalPropertyInitializer.idl',
'nsIDOMHistory.idl',
'nsIDOMJSWindow.idl',

Просмотреть файл

@ -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();
};