Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1187371 - Get rid of dom.broadcastChannel.enabled pref, r=bz
Browse files Browse the repository at this point in the history
  • Loading branch information
bakulf committed Jul 26, 2015
1 parent 68c3d3f commit 71dc1a3
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 151 deletions.
3 changes: 0 additions & 3 deletions b2g/app/b2g.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
43 changes: 0 additions & 43 deletions dom/broadcastchannel/BroadcastChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -299,50 +298,8 @@ class BroadcastChannelFeature final : public workers::WorkerFeature
}
};

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,
Expand Down
2 changes: 0 additions & 2 deletions dom/broadcastchannel/BroadcastChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class BroadcastChannel final
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;

Expand Down
11 changes: 0 additions & 11 deletions dom/broadcastchannel/tests/broadcastchannel_pref_worker.js

This file was deleted.

2 changes: 0 additions & 2 deletions dom/broadcastchannel/tests/mochitest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[DEFAULT]
support-files =
iframe_broadcastchannel.html
broadcastchannel_pref_worker.js
broadcastchannel_sharedWorker.js
broadcastchannel_worker.js
broadcastchannel_worker_alive.js
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion dom/broadcastchannel/tests/test_broadcastchannel_any.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
runTest();

</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
runTest();

</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
runTest();

</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
},

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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
},

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],
Expand Down
72 changes: 0 additions & 72 deletions dom/broadcastchannel/tests/test_broadcastchannel_pref.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
runTest();

</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion dom/broadcastchannel/tests/test_broadcastchannel_self.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest);
runTest();

</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
}

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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTests);
runTests();

</script>
</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTests);
runTests();

</script>
</pre>
Expand Down
3 changes: 1 addition & 2 deletions dom/webidl/BroadcastChannel.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*/

[Constructor(DOMString channel),
Exposed=(Window,Worker),
Func="BroadcastChannel::IsEnabled"]
Exposed=(Window,Worker)]
interface BroadcastChannel : EventTarget {
readonly attribute DOMString name;

Expand Down
3 changes: 0 additions & 3 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 71dc1a3

Please sign in to comment.