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
Родитель 7328385057
Коммит 98cb317bef
2 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -651,13 +651,14 @@ this.SocialService = {
* have knowledge of the currently selected provider here, we will notify * have knowledge of the currently selected provider here, we will notify
* the front end to deal with any reload. * the front end to deal with any reload.
*/ */
updateProvider: function(aDOMDocument, aManifest, aCallback) { updateProvider: function(aUpdateOrigin, aManifest, aCallback) {
let installOrigin = aDOMDocument.nodePrincipal.origin; let originUri = Services.io.newURI(aUpdateOrigin, null, null);
let installType = this.getOriginActivationType(installOrigin); 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 // 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) 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 // overwrite the preference
let string = Cc["@mozilla.org/supports-string;1"]. let string = Cc["@mozilla.org/supports-string;1"].

Просмотреть файл

@ -56,8 +56,8 @@ WorkerAPI.prototype = {
"social.manifest-set": function(data) { "social.manifest-set": function(data) {
// the provider will get reloaded as a result of this call // the provider will get reloaded as a result of this call
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService; let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
let document = this._port._window.document; let origin = this._provider.origin;
SocialService.updateProvider(document, data); SocialService.updateProvider(origin, data);
}, },
"social.reload-worker": function(data) { "social.reload-worker": function(data) {
getFrameWorkerHandle(this._provider.workerURL, null)._worker.reload(); getFrameWorkerHandle(this._provider.workerURL, null)._worker.reload();