Bug 891218 (part 1) - avoid using a DOM document in updateProvider - r=mixedpuppy

This commit is contained in:
Mark Hammond 2013-08-29 09:45:58 +10:00
parent c5d7f1b1d8
commit ad8fb74446
2 changed files with 8 additions and 7 deletions

View File

@ -651,13 +651,14 @@ this.SocialService = {
* 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);
updateProvider: function(aUpdateOrigin, aManifest, aCallback) {
let originUri = Services.io.newURI(aUpdateOrigin, null, null);
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(originUri);
let installType = this.getOriginActivationType(aUpdateOrigin);
// if we get data, we MUST have a valid manifest generated from the data
let manifest = this._manifestFromData(installType, aManifest, aDOMDocument.nodePrincipal);
let manifest = this._manifestFromData(installType, aManifest, principal);
if (!manifest)
throw new Error("SocialService.installProvider: service configuration is invalid from " + installOrigin);
throw new Error("SocialService.installProvider: service configuration is invalid from " + aUpdateOrigin);
// overwrite the preference
let string = Cc["@mozilla.org/supports-string;1"].

View File

@ -56,8 +56,8 @@ WorkerAPI.prototype = {
"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);
let origin = this._provider.origin;
SocialService.updateProvider(origin, data);
},
"social.reload-worker": function(data) {
getFrameWorkerHandle(this._provider.workerURL, null)._worker.reload();