From 2ab86d7fc8a92671f24c7ce9a7f9924b8801a71a Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 23 Jun 2013 23:41:33 -0700 Subject: [PATCH] Back out 9661a68f0bff (bug 872605) for browser-chrome failures --- .../content/test/social/browser_addons.js | 47 +------------------ .../content/test/social/social_activate.html | 2 +- .../base/content/test/social/social_worker.js | 7 --- browser/modules/Social.jsm | 17 ------- toolkit/components/social/SocialService.jsm | 34 -------------- toolkit/components/social/WorkerAPI.jsm | 10 ---- 6 files changed, 2 insertions(+), 115 deletions(-) diff --git a/browser/base/content/test/social/browser_addons.js b/browser/base/content/test/social/browser_addons.js index 3555d9a10868..0de78b4fa4d3 100644 --- a/browser/base/content/test/social/browser_addons.js +++ b/browser/base/content/test/social/browser_addons.js @@ -20,8 +20,7 @@ let manifest2 = { // used for testing install origin: "https://test1.example.com", sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html", workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js", - iconURL: "https://test1.example.com/browser/browser/base/content/test/moz.png", - version: 1 + iconURL: "https://test1.example.com/browser/browser/base/content/test/moz.png" }; function test() { @@ -273,49 +272,5 @@ var tests = { }); }); }); - }, - testUpgradeProviderFromWorker: function(next) { - // add the provider, change the pref, add it again. The provider at that - // point should be upgraded - let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html" - addTab(activationURL, function(tab) { - let doc = tab.linkedBrowser.contentDocument; - let installFrom = doc.nodePrincipal.origin; - Services.prefs.setCharPref("social.whitelist", installFrom); - Social.installProvider(doc, manifest2, function(addonManifest) { - SocialService.addBuiltinProvider(addonManifest.origin, function(provider) { - Social.enabled = true; - checkSocialUI(); - is(Social.provider.manifest.version, 1, "manifest version is 1") - // watch for the provider-update and tell the worker to update - SocialService.registerProviderListener(function providerListener(topic, data) { - if (topic != "provider-update") - return; - SocialService.unregisterProviderListener(providerListener); - observeProviderSet(function() { - Services.prefs.clearUserPref("social.whitelist"); - executeSoon(function() { - is(Social.provider.manifest.version, 2, "manifest version is 2"); - Social.uninstallProvider(addonManifest.origin); - gBrowser.removeTab(tab); - next(); - }) - }); - }); - let port = Social.provider.getWorkerPort(); - port.postMessage({topic: "worker.update", data: true}); - }); - }); - }); } } - - -function observeProviderSet(cb) { - Services.obs.addObserver(function providerSet(subject, topic, data) { - Services.obs.removeObserver(providerSet, "social:provider-set"); - info("social:provider-set observer was notified"); - // executeSoon to let the browser UI observers run first - executeSoon(cb); - }, "social:provider-set", false); -} \ No newline at end of file diff --git a/browser/base/content/test/social/social_activate.html b/browser/base/content/test/social/social_activate.html index b008aad33920..040e1a7589db 100644 --- a/browser/base/content/test/social/social_activate.html +++ b/browser/base/content/test/social/social_activate.html @@ -20,7 +20,7 @@ var data = { "author": "Shane Caraveo, Mozilla", // optional - "version": 1 + "version": "1.0" } function activate(node) { diff --git a/browser/base/content/test/social/social_worker.js b/browser/base/content/test/social/social_worker.js index 1c1fd43e2b5e..a41adb0d45ef 100644 --- a/browser/base/content/test/social/social_worker.js +++ b/browser/base/content/test/social/social_worker.js @@ -137,13 +137,6 @@ onconnect = function(e) { if (testPort) testPort.postMessage({topic:"got-share-data-message", result: event.data.result}); break; - case "worker.update": - apiPort.postMessage({topic: 'social.manifest-get'}); - break; - case "social.manifest": - event.data.data.version = 2; - apiPort.postMessage({topic: 'social.manifest-set', data: event.data.data}); - break; } } } diff --git a/browser/modules/Social.jsm b/browser/modules/Social.jsm index 8bf268a7f5a8..e287effd70c4 100644 --- a/browser/modules/Social.jsm +++ b/browser/modules/Social.jsm @@ -162,23 +162,6 @@ this.Social = { if (topic == "provider-added" || topic == "provider-removed") { this._updateProviderCache(data); Services.obs.notifyObservers(null, "social:providers-changed", null); - return; - } - if (topic == "provider-update") { - // a provider has self-updated its manifest, we need to update our - // cache and possibly reload if it was the current provider. - let provider = data; - SocialService.getOrderedProviderList(function(providers) { - Social._updateProviderCache(providers); - Services.obs.notifyObservers(null, "social:providers-changed", null); - // if we need a reload, do it now - if (provider.enabled) { - Social.enabled = false; - Services.tm.mainThread.dispatch(function() { - Social.enabled = true; - }, Components.interfaces.nsIThread.DISPATCH_NORMAL); - } - }); } }.bind(this)); }, diff --git a/toolkit/components/social/SocialService.jsm b/toolkit/components/social/SocialService.jsm index b56ba666fe74..f1866c5b337b 100644 --- a/toolkit/components/social/SocialService.jsm +++ b/toolkit/components/social/SocialService.jsm @@ -643,36 +643,6 @@ this.SocialService = { } }, - /** - * updateProvider is used from the worker to self-update. Since we do not - * have knowledge of the currently selected provider here, we will notify - * the front end to deal with any reload. - */ - updateProvider: function(aDOMDocument, aManifest, aCallback) { - let installOrigin = aDOMDocument.nodePrincipal.origin; - let installType = this.getOriginActivationType(installOrigin); - // if we get data, we MUST have a valid manifest generated from the data - let manifest = this._manifestFromData(installType, aManifest, aDOMDocument.nodePrincipal); - if (!manifest) - throw new Error("SocialService.installProvider: service configuration is invalid from " + installOrigin); - - // overwrite the preference - let string = Cc["@mozilla.org/supports-string;1"]. - createInstance(Ci.nsISupportsString); - string.data = JSON.stringify(manifest); - Services.prefs.setComplexValue(getPrefnameFromOrigin(manifest.origin), Ci.nsISupportsString, string); - - // overwrite the existing provider then notify the front end so it can - // handle any reload that might be necessary. - if (ActiveProviders.has(manifest.origin)) { - let provider = new SocialProvider(manifest); - SocialServiceInternal.providers[provider.origin] = provider; - // update the cache and ui, reload provider if necessary - this._notifyProviderListeners("provider-update", provider); - } - - }, - uninstallProvider: function(origin) { let manifest = SocialServiceInternal.getManifestByOrigin(origin); let addon = new AddonWrapper(manifest); @@ -741,10 +711,6 @@ SocialProvider.prototype = { } }, - get manifest() { - return SocialServiceInternal.getManifestByOrigin(this.origin); - }, - // Reference to a workerAPI object for this provider. Null if the provider has // no FrameWorker, or is disabled. workerAPI: null, diff --git a/toolkit/components/social/WorkerAPI.jsm b/toolkit/components/social/WorkerAPI.jsm index 7f6dc3021bcb..9acfc0344450 100644 --- a/toolkit/components/social/WorkerAPI.jsm +++ b/toolkit/components/social/WorkerAPI.jsm @@ -49,16 +49,6 @@ WorkerAPI.prototype = { }, handlers: { - "social.manifest-get": function(data) { - // retreive the currently installed manifest from firefox - this._port.postMessage({topic: "social.manifest", data: this._provider.manifest}); - }, - "social.manifest-set": function(data) { - // the provider will get reloaded as a result of this call - let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService; - let document = this._port._window.document; - SocialService.updateProvider(document, data); - }, "social.reload-worker": function(data) { getFrameWorkerHandle(this._provider.workerURL, null)._worker.reload(); // the frameworker is going to be reloaded, send the initialization