Bug 754141 (1/4) - Get the mozapp attribute value from the parent instead of its presence. r=jlebar

This commit is contained in:
Mounir Lamouri 2012-05-16 12:39:27 +02:00
parent 8a3d63dec8
commit 70dc2d8dfb
2 changed files with 7 additions and 6 deletions

View File

@ -54,11 +54,12 @@ BrowserElementChild.prototype = {
// This is because mozapp iframes have some privileges which we don't want
// to extend to untrusted mozbrowser content.
//
// Set the window's isApp state by asking our parent if our iframe has the
// 'mozapp' attribute.
// Get the app manifest from the parent, if our frame has one.
let appManifestURL = sendSyncMsg('get-mozapp-manifest-url')[0];
content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.setIsApp(sendSyncMsg('get-mozapp')[0]);
.setIsApp(!!appManifestURL);
addEventListener('DOMTitleChanged',
this._titleChangedHandler.bind(this),

View File

@ -100,7 +100,7 @@ BrowserElementParent.prototype = {
addMessageListener("loadend", this._fireEventFromMsg);
addMessageListener("titlechange", this._fireEventFromMsg);
addMessageListener("iconchange", this._fireEventFromMsg);
addMessageListener("get-mozapp", this._sendAppState);
addMessageListener("get-mozapp-manifest-url", this._sendMozAppManifestURL);
mm.loadFrameScript("chrome://global/content/BrowserElementChild.js",
/* allowDelayedLoad = */ true);
@ -135,8 +135,8 @@ BrowserElementParent.prototype = {
frameElement.dispatchEvent(evt);
},
_sendAppState: function(frameElement, data) {
return frameElement.hasAttribute('mozapp');
_sendMozAppManifestURL: function(frameElement, data) {
return frameElement.getAttribute('mozapp');
},
observe: function(subject, topic, data) {