diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index 344aba37a8f..1d730ee3dc8 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -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') });