summaryrefslogtreecommitdiff
path: root/dom/base/nsScriptNameSpaceManager.cpp
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2015-06-03 16:35:13 +0200
committerPale Moon <git-repo@palemoon.org>2015-06-03 16:35:13 +0200
commitc5ae685a00f82017b66db0f19c1628df2ff75510 (patch)
tree58cb883b3d6e7e302f621be366b8db96ffebed72 /dom/base/nsScriptNameSpaceManager.cpp
parent5ae69ddc87d82e956dfb5d6c997a78fd42ec24f2 (diff)
downloadpalemoon-gre-c5ae685a00f82017b66db0f19c1628df2ff75510.tar.gz
Remove implicit access to internal/XUL interfaces and classes from the global window instance.
(This will also fix sites that incorrectly try to use it, i.e.: issue #89 will be solved)
Diffstat (limited to 'dom/base/nsScriptNameSpaceManager.cpp')
-rw-r--r--dom/base/nsScriptNameSpaceManager.cpp69
1 files changed, 1 insertions, 68 deletions
diff --git a/dom/base/nsScriptNameSpaceManager.cpp b/dom/base/nsScriptNameSpaceManager.cpp
index ac32f4cd1..bf7e2af65 100644
--- a/dom/base/nsScriptNameSpaceManager.cpp
+++ b/dom/base/nsScriptNameSpaceManager.cpp
@@ -213,69 +213,6 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
}
-// This method enumerates over all installed interfaces (in .xpt
-// files) and finds ones that start with "nsIDOM" and has constants
-// defined in the interface itself (inherited constants doesn't
-// count), once such an interface is found the "nsIDOM" prefix is cut
-// off the name and the rest of the name is added into the hash for
-// global names. This makes things like 'Node.ELEMENT_NODE' work in
-// JS. See nsCommonWindowSH::GlobalResolve() for detais on how this is used.
-
-nsresult
-nsScriptNameSpaceManager::FillHashWithDOMInterfaces()
-{
- nsCOMPtr<nsIInterfaceInfoManager>
- iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
- NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED);
-
- // First look for all interfaces whose name starts with nsIDOM
- nsCOMPtr<nsIEnumerator> domInterfaces;
- nsresult rv =
- iim->EnumerateInterfacesWhoseNamesStartWith(NS_DOM_INTERFACE_PREFIX,
- getter_AddRefs(domInterfaces));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsISupports> entry;
-
- rv = domInterfaces->First();
-
- if (NS_FAILED(rv)) {
- // Empty interface list?
-
- NS_WARNING("What, no nsIDOM interfaces installed?");
-
- return NS_OK;
- }
-
- bool found_old;
- nsCOMPtr<nsIInterfaceInfo> if_info;
- const char *if_name = nullptr;
- const nsIID *iid;
-
- for ( ;
- domInterfaces->IsDone() == static_cast<nsresult>(NS_ENUMERATOR_FALSE);
- domInterfaces->Next()) {
- rv = domInterfaces->CurrentItem(getter_AddRefs(entry));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIInterfaceInfo> if_info(do_QueryInterface(entry));
- if_info->GetNameShared(&if_name);
- if_info->GetIIDShared(&iid);
- rv = RegisterInterface(if_name + sizeof(NS_DOM_INTERFACE_PREFIX) - 1,
- iid, &found_old);
-
-#ifdef DEBUG
- NS_ASSERTION(!found_old,
- "Whaaa, interface name already in hash!");
-#endif
- }
-
- // Next, look for externally registered DOM interfaces
- rv = RegisterExternalInterfaces(false);
-
- return rv;
-}
-
nsresult
nsScriptNameSpaceManager::RegisterExternalInterfaces(bool aAsProto)
{
@@ -340,10 +277,6 @@ nsScriptNameSpaceManager::RegisterExternalInterfaces(bool aAsProto)
const char* name;
if (dom_prefix) {
- if (!aAsProto) {
- // nsIDOM* interfaces have already been registered.
- break;
- }
name = if_name + sizeof(NS_DOM_INTERFACE_PREFIX) - 1;
} else {
name = if_name + sizeof(NS_INTERFACE_PREFIX) - 1;
@@ -426,7 +359,7 @@ nsScriptNameSpaceManager::Init()
nsresult rv = NS_OK;
- rv = FillHashWithDOMInterfaces();
+ rv = RegisterExternalInterfaces(false);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsICategoryManager> cm =