diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 5a4f1031931e..4a9d34071789 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1295,8 +1295,6 @@ pref("social.manifest.facebook", "{\"origin\":\"https://www.facebook.com\",\"nam pref("social.sidebar.open", true); pref("social.sidebar.unload_timeout_ms", 10000); -pref("social.allowMultipleWorkers", true); - pref("dom.identity.enabled", false); // Turn on the CSP 1.0 parser for Content Security Policy headers diff --git a/browser/base/content/test/social/browser_social_chatwindow.js b/browser/base/content/test/social/browser_social_chatwindow.js index a4809f0653a6..c764393f0b37 100644 --- a/browser/base/content/test/social/browser_social_chatwindow.js +++ b/browser/base/content/test/social/browser_social_chatwindow.js @@ -51,6 +51,18 @@ function waitPrefChange(cb) { }, false); } +function setWorkerMode(multiple, cb) { + waitPrefChange(function() { + if (multiple) + Services.prefs.setBoolPref("social.allowMultipleWorkers", true); + else + Services.prefs.clearUserPref("social.allowMultipleWorkers"); + waitPrefChange(cb); + Social.enabled = true; + }); + Social.enabled = false; +} + function test() { requestLongerTimeout(2); // only debug builds seem to need more time... waitForExplicitFinish(); @@ -63,15 +75,8 @@ function test() { ok(chats.children.length == 0, "no chatty children left behind"); cb(); }; - // always run chat tests with multiple workers. - Services.prefs.setBoolPref("social.allowMultipleWorkers", true); runSocialTestWithProvider(manifests, function (finishcb) { - ok(Social.enabled, "Social is enabled"); - ok(Social.providers[0].getWorkerPort(), "provider 0 has port"); - ok(Social.providers[1].getWorkerPort(), "provider 1 has port"); - ok(Social.providers[2].getWorkerPort(), "provider 2 has port"); runSocialTests(tests, undefined, postSubTest, function() { - Services.prefs.clearUserPref("social.allowMultipleWorkers"); window.moveTo(oldleft, window.screenY) window.resizeTo(oldwidth, window.outerHeight); finishcb(); @@ -512,31 +517,30 @@ var tests = { }); }, testMultipleProviderChat: function(next) { - // test incomming chats from all providers - openChat(Social.providers[0], function() { - openChat(Social.providers[1], function() { - openChat(Social.providers[2], function() { - let chats = document.getElementById("pinnedchats"); - waitForCondition(function() chats.children.length == Social.providers.length, - function() { - ok(true, "one chat window per provider opened"); - // test logout of a single provider - let provider = Social.providers[2]; - let port = provider.getWorkerPort(); - port.postMessage({topic: "test-logout"}); - waitForCondition(function() chats.children.length == Social.providers.length - 1, - function() { - chats.removeAll(); - waitForCondition(function() chats.children.length == 0, - function() { - ok(!chats.selectedChat, "multiprovider chats are all closed"); - port.close(); - next(); - }, - "chat windows didn't close"); - }, - "chat window didn't close"); - }, "chat windows did not open"); + // while pref'd off, we need to set the worker mode to multiple providers + setWorkerMode(true, function() { + // test incomming chats from all providers + openChat(Social.providers[0], function() { + openChat(Social.providers[1], function() { + openChat(Social.providers[2], function() { + let chats = document.getElementById("pinnedchats"); + waitForCondition(function() chats.children.length == Social.providers.length, + function() { + ok(true, "one chat window per provider opened"); + // test logout of a single provider + let provider = Social.providers[0]; + let port = provider.getWorkerPort(); + port.postMessage({topic: "test-logout"}); + waitForCondition(function() chats.children.length == Social.providers.length - 1, + function() { + port.close(); + chats.removeAll(); + ok(!chats.selectedChat, "chats are all closed"); + setWorkerMode(false, next); + }, + "chat window didn't close"); + }, "chat windows did not open"); + }); }); }); }); @@ -574,10 +578,6 @@ var tests = { break; } } - // make sure a user profile is set for this provider as chat windows are - // only closed on *change* of the profile data rather than merely setting - // profile data. - port.postMessage({topic: "test-set-profile"}); port.postMessage({topic: "test-init"}); } } diff --git a/browser/base/content/test/social/browser_social_flyout.js b/browser/base/content/test/social/browser_social_flyout.js index 871919b8b73c..1bf2307db9bc 100644 --- a/browser/base/content/test/social/browser_social_flyout.js +++ b/browser/base/content/test/social/browser_social_flyout.js @@ -113,17 +113,15 @@ var tests = { port.postMessage({topic: "test-flyout-open"}); break; case "got-flyout-visibility": - if (e.data.result != "shown") - return; let iframe = panel.firstChild; iframe.contentDocument.addEventListener("SocialTest-DoneCloseSelf", function _doneHandler() { iframe.contentDocument.removeEventListener("SocialTest-DoneCloseSelf", _doneHandler, false); - port.close(); is(panel.state, "closed", "flyout should have closed itself"); Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, oldAllowScriptsToClose); next(); }, false); is(panel.state, "open", "flyout should be open"); + port.close(); // so we don't get the -visibility message as it hides... SocialFlyout.dispatchPanelEvent("socialTest-CloseSelf"); break; } diff --git a/browser/base/content/test/social/social_worker.js b/browser/base/content/test/social/social_worker.js index 1bea0d0ccc6a..256c13e2a4aa 100644 --- a/browser/base/content/test/social/social_worker.js +++ b/browser/base/content/test/social/social_worker.js @@ -84,8 +84,6 @@ onconnect = function(e) { // For multiprovider tests, we support acting like different providers // based on the domain we load from. apiPort = port; - // purposely fall through and set the profile on initialization - case "test-set-profile": let profile; if (location.href.indexOf("https://test1.example.com") == 0) { profile = { @@ -101,7 +99,7 @@ onconnect = function(e) { profileURL: "http://en.wikipedia.org/wiki/Kuma_Lisa" }; } - apiPort.postMessage({topic: "social.user-profile", data: profile}); + port.postMessage({topic: "social.user-profile", data: profile}); break; case "test-ambient-notification": apiPort.postMessage({topic: "social.ambient-notification", data: event.data.data}); diff --git a/browser/modules/Social.jsm b/browser/modules/Social.jsm index 45a476c841fe..ee2d1c430d50 100644 --- a/browser/modules/Social.jsm +++ b/browser/modules/Social.jsm @@ -95,7 +95,8 @@ this.Social = { _disabledForSafeMode: false, get allowMultipleWorkers() { - return Services.prefs.getBoolPref("social.allowMultipleWorkers"); + return Services.prefs.prefHasUserValue("social.allowMultipleWorkers") && + Services.prefs.getBoolPref("social.allowMultipleWorkers"); }, get _currentProviderPref() { @@ -140,7 +141,6 @@ this.Social = { let enabled = !!provider; if (enabled != SocialService.enabled) { SocialService.enabled = enabled; - this._updateWorkerState(enabled); } let origin = this._provider && this._provider.origin; diff --git a/toolkit/components/social/FrameWorker.jsm b/toolkit/components/social/FrameWorker.jsm index 82cafca019b2..014dc51fea8f 100644 --- a/toolkit/components/social/FrameWorker.jsm +++ b/toolkit/components/social/FrameWorker.jsm @@ -199,13 +199,15 @@ function makeRemoteBrowser() { let browser = iframe.contentDocument.createElementNS(XUL_NS, "browser"); browser.setAttribute("type", "content"); browser.setAttribute("disableglobalhistory", "true"); + let remote; // for now we use the same preference that enabled multiple workers - the // idea is that there is no point in having people help test multiple // "old" frameworkers - so anyone who wants multiple workers is forced to // help us test remote frameworkers too. - if (Services.prefs.getBoolPref("social.allowMultipleWorkers")) + if (Services.prefs.prefHasUserValue("social.allowMultipleWorkers") && + Services.prefs.getBoolPref("social.allowMultipleWorkers")) { browser.setAttribute("remote", "true"); - + } iframe.contentDocument.documentElement.appendChild(browser); deferred.resolve(browser); }, true); diff --git a/toolkit/components/social/test/browser/browser_SocialProvider.js b/toolkit/components/social/test/browser/browser_SocialProvider.js index 5cd5931a1978..81582f120619 100644 --- a/toolkit/components/social/test/browser/browser_SocialProvider.js +++ b/toolkit/components/social/test/browser/browser_SocialProvider.js @@ -62,7 +62,7 @@ let tests = { }; SocialService.addProvider(manifest, function (provider2) { ok(provider.enabled, "provider is initially enabled"); - is(provider2.enabled, Services.prefs.getBoolPref("social.allowMultipleWorkers"), "provider2 is enabled status is correct"); + ok(!provider2.enabled, "provider2 is not initially enabled"); provider2.enabled = true; let port = provider.getWorkerPort(); let port2 = provider2.getWorkerPort(); diff --git a/toolkit/components/social/test/browser/browser_frameworker.js b/toolkit/components/social/test/browser/browser_frameworker.js index 2ade7c9fd680..a7d1707e615e 100644 --- a/toolkit/components/social/test/browser/browser_frameworker.js +++ b/toolkit/components/social/test/browser/browser_frameworker.js @@ -49,11 +49,6 @@ let tests = { }, // when the client closes early but the worker tries to send anyway... - // XXX - disabled due to bug 919878 - we close the frameworker before the - // remote browser has completed initializing, leading to failures. Given - // this can realistically only happen in this synthesized test environment, - // disabling just this test seems OK for now. -/*** testEarlyClose: function(cbnext) { let run = function() { onconnect = function(e) { @@ -67,7 +62,6 @@ let tests = { worker.terminate(); cbnext(); }, -***/ // Check we do get a social.port-closing message as the port is closed. testPortClosingMessage: function(cbnext) {