diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index d9067d9e8725..6a5bca1d9f92 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -50,7 +50,6 @@ #include "nsContentUtils.h" #include "nsCxPusher.h" #include "nsIDOMGlobalPropertyInitializer.h" -#include "nsLocation.h" #include "mozilla/Attributes.h" #include "mozilla/Telemetry.h" @@ -261,11 +260,6 @@ static nsDOMClassInfoData sClassInfoData[] = { DEFAULT_SCRIPTABLE_FLAGS | WINDOW_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(Location, nsLocationSH, - ((DOM_DEFAULT_SCRIPTABLE_FLAGS | - nsIXPCScriptable::WANT_ADDPROPERTY) & - ~nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE)) - NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH, DOM_BASE_SCRIPTABLE_FLAGS | nsIXPCScriptable::WANT_PRECREATE | @@ -823,10 +817,6 @@ nsDOMClassInfo::Init() #endif DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation) - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor) DOM_CLASSINFO_MAP_END @@ -3277,62 +3267,6 @@ nsWindowSH::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, return NS_OK; } -NS_IMETHODIMP -nsLocationSH::PreCreate(nsISupports *nativeObj, JSContext *cx, - JSObject *globalObj, JSObject **parentObj) -{ - // window.location can be held onto by both evil pages that want to track the - // user's progress on the web and bookmarklets that want to use the location - // object. Parent it to the outer window so that access checks do the Right - // Thing. - *parentObj = globalObj; - - nsCOMPtr safeLoc(do_QueryInterface(nativeObj)); - if (!safeLoc) { - // Oops, this wasn't really a location object. This can happen if someone - // tries to use our scriptable helper as a real object and tries to wrap - // it, see bug 319296 - return NS_OK; - } - - nsLocation *loc = (nsLocation *)safeLoc.get(); - nsIDocShell *ds = loc->GetDocShell(); - if (!ds) { - NS_WARNING("Refusing to create a location in the wrong scope"); - return NS_ERROR_UNEXPECTED; - } - - nsCOMPtr sgo = do_GetInterface(ds); - if (!sgo) { - NS_WARNING("Refusing to create a location in the wrong scope because the " - "docshell is being destroyed"); - return NS_ERROR_UNEXPECTED; - } - - *parentObj = sgo->GetGlobalJSObject(); - return *parentObj ? NS_OK : NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsLocationSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, - JSObject *obj, jsid aId, jsval *vp, bool *_retval) -{ - JS::Rooted rootedObj(cx, obj); - - // Shadowing protection. This will go away when nsLocation moves to the new - // bindings. - JS::Rooted id(cx, aId); - if (wrapper->HasNativeMember(id)) { - JS_ReportError(cx, "Permission denied to shadow native property"); - return NS_ERROR_FAILURE; - } - - nsLocation* location = static_cast(GetNative(wrapper, rootedObj)); - location->PreserveWrapper(location); - - return NS_OK; -} - // EventTarget helper NS_IMETHODIMP diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index fe0e872340fc..36ac3e74525f 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -277,31 +277,6 @@ public: } }; -// Location scriptable helper - -class nsLocationSH : public nsDOMGenericSH -{ -protected: - nsLocationSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) - { - } - - virtual ~nsLocationSH() - { - } - -public: - NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, - JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE; - NS_IMETHODIMP AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, - JSObject *obj, jsid id, JS::Value *vp, bool *_retval); - - static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) - { - return new nsLocationSH(aData); - } -}; - // Event handler 'this' translator class, this is called by XPConnect // when a "function interface" (nsIDOMEventListener) is called, this diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index 316e178575dd..e069a30361d6 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -5,7 +5,6 @@ // IWYU pragma: private, include "nsDOMClassInfoID.h" DOMCI_CLASS(Window) -DOMCI_CLASS(Location) DOMCI_CLASS(DOMPrototype) DOMCI_CLASS(DOMConstructor) diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index 4727e4bdb040..7012d500176c 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -70,14 +70,11 @@ nsLocation::~nsLocation() { } -DOMCI_DATA(Location, nsLocation) - // QueryInterface implementation for nsLocation NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsLocation) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsIDOMLocation) NS_INTERFACE_MAP_ENTRY(nsISupports) - NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Location) NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsLocation, mInnerWindow) diff --git a/js/xpconnect/src/dom_quickstubs.qsconf b/js/xpconnect/src/dom_quickstubs.qsconf index a945096024d8..68be77a1c231 100644 --- a/js/xpconnect/src/dom_quickstubs.qsconf +++ b/js/xpconnect/src/dom_quickstubs.qsconf @@ -27,10 +27,6 @@ members = [ # # (And nsIDOMModalContentWindow.returnValue is an attribute of type # nsIVariant, which qsgen.py can't handle.) - # - # nsLocationSH has ~ALLOW_PROP_MODS_TO_PROTOTYPE, so don't try. - #'nsIDOMLocation.hostname', - #'nsIDOMLocation.href', # dom/interfaces/xpath 'nsIDOMXPathNSResolver.lookupNamespaceURI',