summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-03-04 15:34:17 +0000
committerMoonchild <moonchild@palemoon.org>2022-03-04 15:34:17 +0000
commit6714b6ba73af4de3eedde8c0380b26528affc534 (patch)
tree5cc51b2206f78de0245be7723179871a8dc4a8cc
parenta05a65278058562ce7bcab7b6a58e256436aa853 (diff)
downloadGRE-6714b6ba73af4de3eedde8c0380b26528affc534.tar.gz
Issue #2 - De-unify sources in xpconnect
This also removes some e10s code. Tag: #12
-rw-r--r--js/xpconnect/src/Sandbox.cpp1
-rw-r--r--js/xpconnect/src/XPCJSContext.cpp3
-rw-r--r--js/xpconnect/src/XPCJSID.cpp1
-rw-r--r--js/xpconnect/src/XPCLocale.cpp1
-rw-r--r--js/xpconnect/src/XPCRuntimeService.cpp1
-rw-r--r--js/xpconnect/src/XPCWrappedNativeInfo.cpp17
-rw-r--r--js/xpconnect/src/XPCWrappedNativeJSOps.cpp1
-rw-r--r--js/xpconnect/src/XPCWrappedNativeScope.cpp1
-rw-r--r--js/xpconnect/src/moz.build8
-rw-r--r--js/xpconnect/wrappers/AddonWrapper.cpp2
-rw-r--r--js/xpconnect/wrappers/FilteringWrapper.cpp1
-rw-r--r--js/xpconnect/wrappers/WrapperFactory.cpp42
-rw-r--r--js/xpconnect/wrappers/moz.build2
13 files changed, 30 insertions, 51 deletions
diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp
index aa99ba69b..4b8af9a60 100644
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -48,6 +48,7 @@
#include "mozilla/DeferredFinalize.h"
using namespace mozilla;
+using namespace mozilla::dom;
using namespace JS;
using namespace xpc;
diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
index 48a3aa26a..dbd0797c8 100644
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -22,6 +22,7 @@
#include "nsIObserverService.h"
#include "nsIDebug2.h"
#include "nsIDocShell.h"
+#include "nsIInputStream.h"
#include "nsIRunnable.h"
#include "amIAddonManager.h"
#include "nsPIDOMWindow.h"
@@ -29,6 +30,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/dom/ScriptSettings.h"
+#include "mozilla/dom/Promise.h"
#include "nsContentUtils.h"
#include "nsCCUncollectableMarker.h"
@@ -62,6 +64,7 @@
#endif
using namespace mozilla;
+using namespace mozilla::dom;
using namespace xpc;
using namespace JS;
using mozilla::dom::PerThreadAtomCache;
diff --git a/js/xpconnect/src/XPCJSID.cpp b/js/xpconnect/src/XPCJSID.cpp
index 2bf3939bf..14525f115 100644
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -11,6 +11,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/StaticPtr.h"
+#include "nsContentUtils.h"
using namespace mozilla::dom;
using namespace JS;
diff --git a/js/xpconnect/src/XPCLocale.cpp b/js/xpconnect/src/XPCLocale.cpp
index 9a55c0ec8..d89f78fc5 100644
--- a/js/xpconnect/src/XPCLocale.cpp
+++ b/js/xpconnect/src/XPCLocale.cpp
@@ -22,6 +22,7 @@
#include "xpcpublic.h"
using namespace JS;
+using namespace mozilla;
using mozilla::dom::EncodingUtils;
/**
diff --git a/js/xpconnect/src/XPCRuntimeService.cpp b/js/xpconnect/src/XPCRuntimeService.cpp
index c460052fe..7ca8689a7 100644
--- a/js/xpconnect/src/XPCRuntimeService.cpp
+++ b/js/xpconnect/src/XPCRuntimeService.cpp
@@ -37,6 +37,7 @@ NS_IMPL_RELEASE(BackstagePass)
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \
nsIXPCScriptable::IS_GLOBAL_OBJECT | \
nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES
+#include "xpc_make_class.h"
#include "xpc_map_end.h" /* This will #undef the above */
diff --git a/js/xpconnect/src/XPCWrappedNativeInfo.cpp b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
index a93b006f0..fe089b511 100644
--- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
@@ -235,23 +235,6 @@ XPCNativeInterface::NewInstance(nsIInterfaceInfo* aInfo)
bool mainProcessScriptableOnly;
if (NS_FAILED(aInfo->IsMainProcessScriptableOnly(&mainProcessScriptableOnly)))
return nullptr;
- if (mainProcessScriptableOnly && !XRE_IsParentProcess()) {
- nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
- if (console) {
- const char* intfNameChars;
- aInfo->GetNameShared(&intfNameChars);
- nsPrintfCString errorMsg("Use of %s in content process is deprecated.", intfNameChars);
-
- nsAutoString filename;
- uint32_t lineno = 0, column = 0;
- nsJSUtils::GetCallingLocation(cx, filename, &lineno, &column);
- nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
- error->Init(NS_ConvertUTF8toUTF16(errorMsg),
- filename, EmptyString(),
- lineno, column, nsIScriptError::warningFlag, "chrome javascript");
- console->LogMessage(error);
- }
- }
if (NS_FAILED(aInfo->GetMethodCount(&methodCount)) ||
NS_FAILED(aInfo->GetConstantCount(&constCount)))
diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
index 6c343e1e8..737638af9 100644
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -13,6 +13,7 @@
#include "nsIAddonInterposition.h"
#include "AddonWrapper.h"
#include "js/Class.h"
+#include "nsContentUtils.h"
using namespace mozilla;
using namespace JS;
diff --git a/js/xpconnect/src/XPCWrappedNativeScope.cpp b/js/xpconnect/src/XPCWrappedNativeScope.cpp
index 4f4e9e740..b9aa6f7f2 100644
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -14,6 +14,7 @@
#include "mozilla/Preferences.h"
#include "nsIAddonInterposition.h"
#include "nsIXULRuntime.h"
+#include "AccessCheck.h"
#include "mozilla/dom/BindingUtils.h"
diff --git a/js/xpconnect/src/moz.build b/js/xpconnect/src/moz.build
index d2d1c3b28..67fc42b17 100644
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -11,11 +11,12 @@ EXPORTS += [
'xpcpublic.h',
]
-UNIFIED_SOURCES += [
+SOURCES += [
'ExportHelpers.cpp',
'nsXPConnect.cpp',
'Sandbox.cpp',
'XPCCallContext.cpp',
+ 'XPCComponents.cpp',
'XPCConvert.cpp',
'XPCDebug.cpp',
'XPCException.cpp',
@@ -41,11 +42,6 @@ UNIFIED_SOURCES += [
'XPCWrapper.cpp',
]
-# XPCComponents.cpp cannot be built in unified mode because it uses plarena.h.
-SOURCES += [
- 'XPCComponents.cpp',
-]
-
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
diff --git a/js/xpconnect/wrappers/AddonWrapper.cpp b/js/xpconnect/wrappers/AddonWrapper.cpp
index fdab6c248..73420c280 100644
--- a/js/xpconnect/wrappers/AddonWrapper.cpp
+++ b/js/xpconnect/wrappers/AddonWrapper.cpp
@@ -11,6 +11,7 @@
#include "nsIAddonInterposition.h"
#include "xpcprivate.h"
#include "mozilla/dom/BindingUtils.h"
+#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "nsGlobalWindow.h"
#include "GeckoProfiler.h"
@@ -19,6 +20,7 @@
using namespace js;
using namespace JS;
+using namespace mozilla;
namespace xpc {
diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp
index 11f6e556c..0291e9df4 100644
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -12,6 +12,7 @@
using namespace JS;
using namespace js;
+using namespace mozilla;
namespace xpc {
diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp
index fc8c06351..d8f8e4ee1 100644
--- a/js/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/xpconnect/wrappers/WrapperFactory.cpp
@@ -442,40 +442,28 @@ WrapperFactory::Rewrap(JSContext* cx, HandleObject existing, HandleObject obj)
// First, handle the special cases.
//
- // If UniversalXPConnect is enabled, this is just some dumb mochitest. Use
- // a vanilla CCW.
if (xpc::IsUniversalXPConnectEnabled(target)) {
+ // If UniversalXPConnect is enabled, this is just some dumb mochitest. Use
+ // a vanilla CCW.
CrashIfNotInAutomation();
wrapper = &CrossCompartmentWrapper::singleton;
- }
-
- // Let the SpecialPowers scope make its stuff easily accessible to content.
- else if (CompartmentPrivate::Get(origin)->forcePermissiveCOWs) {
+ } else if (CompartmentPrivate::Get(origin)->forcePermissiveCOWs) {
+ // Let the SpecialPowers scope make its stuff easily accessible to content.
CrashIfNotInAutomation();
wrapper = &CrossCompartmentWrapper::singleton;
- }
-
- // Special handling for chrome objects being exposed to content.
- else if (originIsChrome && !targetIsChrome) {
- // If this is a chrome function being exposed to content, we need to allow
- // call (but nothing else). We allow CPOWs that purport to be function's
- // here, but only in the content process.
- if ((IdentifyStandardInstance(obj) == JSProto_Function ||
- (jsipc::IsCPOW(obj) && JS::IsCallable(obj) &&
- XRE_IsContentProcess())))
- {
+ } else if (originIsChrome && !targetIsChrome) {
+ // Special handling for chrome objects being exposed to content.
+ if (IdentifyStandardInstance(obj) == JSProto_Function) {
+ // If this is a chrome function being exposed to content, we need to allow
+ // call (but nothing else).
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper, OpaqueWithCall>::singleton;
- }
-
- // For Vanilla JSObjects exposed from chrome to content, we use a wrapper
- // that supports __exposedProps__. We'd like to get rid of these eventually,
- // but in their current form they don't cause much trouble.
- else if (IdentifyStandardInstance(obj) == JSProto_Object) {
+ } else if (IdentifyStandardInstance(obj) == JSProto_Object) {
+ // For Vanilla JSObjects exposed from chrome to content, we use a wrapper
+ // that supports __exposedProps__. We'd like to get rid of these eventually,
+ // but in their current form they don't cause much trouble.
wrapper = &ChromeObjectWrapper::singleton;
- }
-
- // Otherwise we get an opaque wrapper.
- else {
+ } else {
+ // Otherwise we get an opaque wrapper.
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper, Opaque>::singleton;
}
}
diff --git a/js/xpconnect/wrappers/moz.build b/js/xpconnect/wrappers/moz.build
index 8b70b0e75..21a2c9565 100644
--- a/js/xpconnect/wrappers/moz.build
+++ b/js/xpconnect/wrappers/moz.build
@@ -7,7 +7,7 @@ EXPORTS += [
'WrapperFactory.h',
]
-UNIFIED_SOURCES += [
+SOURCES += [
'AccessCheck.cpp',
'AddonWrapper.cpp',
'ChromeObjectWrapper.cpp',