зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1187371 - Get rid of dom.broadcastChannel.enabled pref, r=bz
This commit is contained in:
Родитель
904118cf22
Коммит
1181ff2812
|
@ -1118,9 +1118,6 @@ pref("services.mobileid.server.uri", "https://msisdn.services.mozilla.com");
|
|||
pref("dom.mapped_arraybuffer.enabled", true);
|
||||
#endif
|
||||
|
||||
// BroadcastChannel API
|
||||
pref("dom.broadcastChannel.enabled", true);
|
||||
|
||||
// SystemUpdate API
|
||||
pref("dom.system_update.enabled", true);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
|
||||
|
@ -299,50 +298,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class PrefEnabledRunnable final : public WorkerMainThreadRunnable
|
||||
{
|
||||
public:
|
||||
explicit PrefEnabledRunnable(WorkerPrivate* aWorkerPrivate)
|
||||
: WorkerMainThreadRunnable(aWorkerPrivate)
|
||||
, mEnabled(false)
|
||||
{ }
|
||||
|
||||
bool MainThreadRun() override
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
mEnabled = Preferences::GetBool("dom.broadcastChannel.enabled", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsEnabled() const
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
private:
|
||||
bool mEnabled;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
/* static */ bool
|
||||
BroadcastChannel::IsEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.broadcastChannel.enabled", false);
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
workerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
nsRefPtr<PrefEnabledRunnable> runnable =
|
||||
new PrefEnabledRunnable(workerPrivate);
|
||||
runnable->Dispatch(workerPrivate->GetJSContext());
|
||||
|
||||
return runnable->IsEnabled();
|
||||
}
|
||||
|
||||
BroadcastChannel::BroadcastChannel(nsPIDOMWindow* aWindow,
|
||||
const PrincipalInfo& aPrincipalInfo,
|
||||
const nsACString& aOrigin,
|
||||
|
|
|
@ -47,8 +47,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BroadcastChannel,
|
||||
DOMEventTargetHelper)
|
||||
|
||||
static bool IsEnabled(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
onmessage = function() {
|
||||
var exists = true;
|
||||
try {
|
||||
var bc = new BroadcastChannel('foobar');
|
||||
} catch(e) {
|
||||
exists = false;
|
||||
}
|
||||
|
||||
postMessage({ exists: exists });
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
iframe_broadcastchannel.html
|
||||
broadcastchannel_pref_worker.js
|
||||
broadcastchannel_sharedWorker.js
|
||||
broadcastchannel_worker.js
|
||||
broadcastchannel_worker_alive.js
|
||||
|
@ -17,7 +16,6 @@ support-files =
|
|||
[test_broadcastchannel_basic.html]
|
||||
[test_broadcastchannel_close.html]
|
||||
[test_broadcastchannel_self.html]
|
||||
[test_broadcastchannel_pref.html]
|
||||
[test_broadcastchannel_sharedWorker.html]
|
||||
[test_broadcastchannel_worker.html]
|
||||
[test_broadcastchannel_worker_alive.html]
|
||||
|
|
|
@ -130,7 +130,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -55,7 +55,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -54,7 +54,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -84,8 +84,7 @@ var steps = [
|
|||
},
|
||||
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true],
|
||||
["network.disable.ipc.security", true],
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.disable.ipc.security", true],
|
||||
["browser.pagethumbnails.capturing_disabled", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.ipc.browser_frames.oop_by_default", false],
|
||||
|
|
|
@ -84,8 +84,7 @@ var steps = [
|
|||
},
|
||||
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true],
|
||||
["network.disable.ipc.security", true],
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.disable.ipc.security", true],
|
||||
["browser.pagethumbnails.capturing_disabled", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.ipc.browser_frames.oop_by_default", false],
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for BroadcastChannel</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="content"></div>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
function testNoPref() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", false]]}, function() {
|
||||
ok(!("BroadcastChannel" in window), "BroadcastChannel should not exist");
|
||||
runTests();
|
||||
});
|
||||
}
|
||||
|
||||
function testPref() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, function() {
|
||||
ok("BroadcastChannel" in window, "BroadcastChannel should exist");
|
||||
runTests();
|
||||
});
|
||||
}
|
||||
|
||||
function testNoPrefWorker() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", false]]}, function() {
|
||||
var worker = new Worker("broadcastchannel_pref_worker.js");
|
||||
worker.onmessage = function(event) {
|
||||
ok(!event.data.exists, "BroadcastChannel should not exist in workers");
|
||||
runTests();
|
||||
}
|
||||
worker.postMessage('go!');
|
||||
});
|
||||
}
|
||||
|
||||
function testPrefWorker() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, function() {
|
||||
var worker = new Worker("broadcastchannel_pref_worker.js");
|
||||
worker.onmessage = function(event) {
|
||||
ok(event.data.exists, "BroadcastChannel should exist in workers");
|
||||
runTests();
|
||||
}
|
||||
worker.postMessage('go!');
|
||||
});
|
||||
}
|
||||
|
||||
var tests = [
|
||||
testNoPref,
|
||||
testPref,
|
||||
testNoPrefWorker,
|
||||
testPrefWorker
|
||||
];
|
||||
|
||||
function runTests() {
|
||||
if (tests.length == 0) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var test = tests.shift();
|
||||
test();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runTests();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -109,7 +109,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -30,7 +30,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -44,8 +44,7 @@ function runTests() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true],
|
||||
["dom.workers.sharedWorkers.enabled", true]]}, runTests);
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.workers.sharedWorkers.enabled", true]]}, runTests);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -54,7 +54,7 @@ function runTests() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTests);
|
||||
runTests();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -48,7 +48,7 @@ function runTests() {
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTests);
|
||||
runTests();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
*/
|
||||
|
||||
[Constructor(DOMString channel),
|
||||
Exposed=(Window,Worker),
|
||||
Func="BroadcastChannel::IsEnabled"]
|
||||
Exposed=(Window,Worker)]
|
||||
interface BroadcastChannel : EventTarget {
|
||||
readonly attribute DOMString name;
|
||||
|
||||
|
|
|
@ -4717,9 +4717,6 @@ pref("dom.voicemail.enabled", false);
|
|||
// parameter omitted.
|
||||
pref("dom.voicemail.defaultServiceId", 0);
|
||||
|
||||
// DOM BroadcastChannel API.
|
||||
pref("dom.broadcastChannel.enabled", true);
|
||||
|
||||
// DOM Inter-App Communication API.
|
||||
pref("dom.inter-app-communication-api.enabled", false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче