Back out 9661a68f0bff (bug 872605) for browser-chrome failures

This commit is contained in:
Phil Ringnalda 2013-06-23 23:41:33 -07:00
parent 74b997bffe
commit 2ab86d7fc8
6 changed files with 2 additions and 115 deletions

View File

@ -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);
}

View File

@ -20,7 +20,7 @@ var data = {
"author": "Shane Caraveo, Mozilla",
// optional
"version": 1
"version": "1.0"
}
function activate(node) {

View File

@ -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;
}
}
}

View File

@ -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));
},

View File

@ -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,

View File

@ -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