From 5f1776f8009a14a46537e1a3ecb4427005280bf7 Mon Sep 17 00:00:00 2001 From: Iris Hsiao Date: Wed, 16 Nov 2016 15:19:46 +0800 Subject: [PATCH] Backed out changeset c78f97c0b771 (bug 1314955) --- js/xpconnect/src/XPCShellImpl.cpp | 18 ------------------ js/xpconnect/tests/components/native/moz.build | 7 ++----- .../tests/components/native/xpctest_module.cpp | 5 ++++- .../tests/components/native/xpctest_private.h | 3 --- js/xpconnect/tests/unit/test_attributes.js | 2 +- js/xpconnect/tests/unit/test_params.js | 2 +- js/xpconnect/tests/unit/test_returncode.js | 2 +- 7 files changed, 9 insertions(+), 30 deletions(-) diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index 9d38c61c0c9f..d86b5c5d3e3d 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -28,7 +28,6 @@ #include "nsJSPrincipals.h" #include "xpcpublic.h" #include "xpcprivate.h" -#include "xpctest_private.h" #include "BackstagePass.h" #include "nsIScriptSecurityManager.h" #include "nsIPrincipal.h" @@ -644,22 +643,6 @@ RegisterAppManifest(JSContext* cx, unsigned argc, Value* vp) return true; } -static bool -RegisterXPCTestComponents(JSContext* cx, unsigned argc, Value* vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (args.length() != 0) { - JS_ReportErrorASCII(cx, "Wrong number of arguments"); - return false; - } - nsresult rv = XRE_AddStaticComponent(&kXPCTestModule); - if (NS_FAILED(rv)) { - XPCThrower::Throw(rv, cx); - return false; - } - return true; -} - static const JSFunctionSpec glob_functions[] = { JS_FS("print", Print, 0,0), JS_FS("readline", ReadLine, 1,0), @@ -679,7 +662,6 @@ static const JSFunctionSpec glob_functions[] = { JS_FS("setInterruptCallback", SetInterruptCallback, 1,0), JS_FS("simulateActivityCallback", SimulateActivityCallback, 1,0), JS_FS("registerAppManifest", RegisterAppManifest, 1, 0), - JS_FS("registerXPCTestComponents", RegisterXPCTestComponents, 0, 0), JS_FS_END }; diff --git a/js/xpconnect/tests/components/native/moz.build b/js/xpconnect/tests/components/native/moz.build index 9c2343dfd3ed..25d1cb9429d6 100644 --- a/js/xpconnect/tests/components/native/moz.build +++ b/js/xpconnect/tests/components/native/moz.build @@ -4,10 +4,7 @@ # 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/. -EXPORTS += [ - 'xpctest_private.h', -] - +FINAL_TARGET = '_tests/xpcshell/js/xpconnect/tests/components/native/' EXTRA_COMPONENTS += [ 'xpctest.manifest', ] @@ -19,4 +16,4 @@ UNIFIED_SOURCES += [ 'xpctest_returncode.cpp', ] -FINAL_LIBRARY = 'xul' +XPCOMBinaryComponent('xpctest') diff --git a/js/xpconnect/tests/components/native/xpctest_module.cpp b/js/xpconnect/tests/components/native/xpctest_module.cpp index 90453eefe87c..f6c29968b98b 100644 --- a/js/xpconnect/tests/components/native/xpctest_module.cpp +++ b/js/xpconnect/tests/components/native/xpctest_module.cpp @@ -6,6 +6,7 @@ /* module registration and factory code. */ +#include "mozilla/ModuleUtils.h" #include "xpctest_private.h" #define NS_XPCTESTOBJECTREADONLY_CID \ @@ -49,8 +50,10 @@ static const mozilla::Module::ContractIDEntry kXPCTestContracts[] = { { nullptr } }; -const mozilla::Module kXPCTestModule = { +static const mozilla::Module kXPCTestModule = { mozilla::Module::kVersion, kXPCTestCIDs, kXPCTestContracts }; + +NSMODULE_DEFN(xpconnect_test) = &kXPCTestModule; diff --git a/js/xpconnect/tests/components/native/xpctest_private.h b/js/xpconnect/tests/components/native/xpctest_private.h index 8d7abf78d7be..45e3f12e4857 100644 --- a/js/xpconnect/tests/components/native/xpctest_private.h +++ b/js/xpconnect/tests/components/native/xpctest_private.h @@ -16,9 +16,6 @@ #include "xpctest_params.h" #include "xpctest_returncode.h" #include "mozilla/Attributes.h" -#include "mozilla/ModuleUtils.h" - -extern const mozilla::Module kXPCTestModule; class xpcTestObjectReadOnly final : public nsIXPCTestObjectReadOnly { public: diff --git a/js/xpconnect/tests/unit/test_attributes.js b/js/xpconnect/tests/unit/test_attributes.js index 4d220669d2f3..52dbb59e6565 100644 --- a/js/xpconnect/tests/unit/test_attributes.js +++ b/js/xpconnect/tests/unit/test_attributes.js @@ -8,7 +8,7 @@ const Ci = Components.interfaces; function run_test() { // Load the component manifests. - registerXPCTestComponents(); + registerAppManifest(do_get_file('../components/native/chrome.manifest')); registerAppManifest(do_get_file('../components/js/xpctest.manifest')); // Test for each component. diff --git a/js/xpconnect/tests/unit/test_params.js b/js/xpconnect/tests/unit/test_params.js index b2cc6fcc2a22..dfe4b822ab83 100644 --- a/js/xpconnect/tests/unit/test_params.js +++ b/js/xpconnect/tests/unit/test_params.js @@ -8,7 +8,7 @@ const Ci = Components.interfaces; function run_test() { // Load the component manifests. - registerXPCTestComponents(); + registerAppManifest(do_get_file('../components/native/chrome.manifest')); registerAppManifest(do_get_file('../components/js/xpctest.manifest')); // Test for each component. diff --git a/js/xpconnect/tests/unit/test_returncode.js b/js/xpconnect/tests/unit/test_returncode.js index 968c269bceba..8ba76c976999 100644 --- a/js/xpconnect/tests/unit/test_returncode.js +++ b/js/xpconnect/tests/unit/test_returncode.js @@ -16,7 +16,7 @@ function getConsoleMessages() { function run_test() { // Load the component manifests. - registerXPCTestComponents(); + registerAppManifest(do_get_file('../components/native/chrome.manifest')); registerAppManifest(do_get_file('../components/js/xpctest.manifest')); // and the tests.