Bug 1024529 - use cloneInto instead of exposedProps in b2g's shell.js, r=ochameau

--HG--
extra : rebase_source : 7c2e3ccaa931e3cbdee44d4e68c8d07b9a28a8eb
This commit is contained in:
Gijs Kruitbosch 2014-06-12 16:50:36 +01:00
Родитель 92cf30b554
Коммит 4286dc52bc
1 изменённых файлов: 7 добавлений и 19 удалений

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

@ -585,8 +585,7 @@ var shell = {
return;
}
this.sendEvent(getContentWindow(), "mozChromeEvent",
Cu.cloneInto(details, getContentWindow()));
this.sendCustomEvent("mozChromeEvent", details);
},
receiveMessage: function shell_receiveMessage(message) {
@ -760,16 +759,11 @@ var WebappsHelper = {
let manifest = new ManifestHelper(aManifest, json.origin);
let payload = {
__exposedProps__: {
timestamp: "r",
url: "r",
manifestURL: "r"
},
timestamp: json.timestamp,
url: manifest.fullLaunchPath(json.startPoint),
manifestURL: json.manifestURL
}
shell.sendEvent(getContentWindow(), "webapps-launch", payload);
};
shell.sendCustomEvent("webapps-launch", payload);
});
break;
case "webapps-ask-install":
@ -781,11 +775,9 @@ var WebappsHelper = {
});
break;
case "webapps-close":
shell.sendEvent(getContentWindow(), "webapps-close",
{
__exposedProps__: { "manifestURL": "r" },
"manifestURL": json.manifestURL
});
shell.sendCustomEvent("webapps-close", {
"manifestURL": json.manifestURL
});
break;
}
}
@ -984,11 +976,7 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
context.drawWindow(window, 0, 0, width, height,
'rgb(255,255,255)', flags);
// I can't use sendChromeEvent() here because it doesn't wrap
// the blob in the detail object correctly. So I use __exposedProps__
// instead to safely send the chrome detail object to content.
shell.sendEvent(getContentWindow(), 'mozChromeEvent', {
__exposedProps__: { type: 'r', file: 'r' },
shell.sendChromeEvent({
type: 'take-screenshot-success',
file: canvas.mozGetAsFile('screenshot', 'image/png')
});