author | Wes Kocher <wkocher@mozilla.com> |
Mon, 14 Oct 2013 18:15:19 -0700 | |
changeset 164505 | 608de8acc55fb180d4d2385db3a1ae05ccb68567 |
parent 164491 | 3a486112072b5564d79997770692a6a52b44b239 (current diff) |
parent 164504 | 45881cb21593f15e87fb06c300a844e43eb054b6 (diff) |
child 164536 | ddd03c32fab13099b81e21cdd38f1a2a4565fb3b |
push id | 3066 |
push user | akeybl@mozilla.com |
push date | Mon, 09 Dec 2013 19:58:46 +0000 |
treeherder | mozilla-beta@a31a0dce83aa [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 27.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -524,43 +524,54 @@ var shell = { }, sendEvent: function shell_sendEvent(content, type, details) { let event = content.document.createEvent('CustomEvent'); event.initCustomEvent(type, true, true, details ? details : {}); content.dispatchEvent(event); }, + sendCustomEvent: function shell_sendCustomEvent(type, details) { + let content = getContentWindow(); + let event = content.document.createEvent('CustomEvent'); + let payload = details ? ObjectWrapper.wrap(details, content) : {}; + event.initCustomEvent(type, true, true, payload); + content.dispatchEvent(event); + }, + sendChromeEvent: function shell_sendChromeEvent(details) { if (!this.isHomeLoaded) { if (!('pendingChromeEvents' in this)) { this.pendingChromeEvents = []; } this.pendingChromeEvents.push(details); return; } this.sendEvent(getContentWindow(), "mozChromeEvent", ObjectWrapper.wrap(details, getContentWindow())); }, openAppForSystemMessage: function shell_openAppForSystemMessage(msg) { let origin = Services.io.newURI(msg.manifest, null, null).prePath; - this.sendChromeEvent({ - type: 'open-app', + let payload = { url: msg.uri, manifestURL: msg.manifest, isActivity: (msg.type == 'activity'), onlyShowApp: msg.onlyShowApp, showApp: msg.showApp, target: msg.target, expectingSystemMessage: true, extra: msg.extra - }); + } + this.sendCustomEvent('open-app', payload); + // XXX Remove once the gaia part of bug 924032 has landed. + payload.type = 'open-app'; + this.sendChromeEvent(payload); }, receiveMessage: function shell_receiveMessage(message) { var activities = { 'content-handler': { name: 'view', response: null }, 'dial-handler': { name: 'dial', response: null }, 'mail-handler': { name: 'new', response: null }, 'sms-handler': { name: 'new', response: null }, 'file-picker': { name: 'pick', response: 'file-picked' } }; @@ -942,37 +953,50 @@ var WebappsHelper = { switch(topic) { case "webapps-launch": DOMApplicationRegistry.getManifestFor(json.manifestURL, function(aManifest) { if (!aManifest) return; let manifest = new ManifestHelper(aManifest, json.origin); - shell.sendChromeEvent({ - "type": "webapps-launch", - "timestamp": json.timestamp, - "url": manifest.fullLaunchPath(json.startPoint), - "manifestURL": json.manifestURL - }); + 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); + // XXX Remove once the gaia side of bug 924032 lands. + payload.type = "webapps-launch"; + delete payload.__exposedProps__; + shell.sendChromeEvent(payload); }); break; case "webapps-ask-install": let id = this.registerInstaller(json); shell.sendChromeEvent({ type: "webapps-ask-install", id: id, app: json.app }); break; case "webapps-close": - shell.sendChromeEvent({ - "type": "webapps-close", - "manifestURL": json.manifestURL - }); + shell.sendEvent(shell.getContentWindow(), "webapps-close", + { + __exposedProps__: { "manifestURL": "r" }, + "manifestURL": json.manifestURL + }); + // XXX Remove once the gaia side of bug 924032 lands. + shell.sendChromeEvent({ type: "webapps-close", + "manifestURL": json.manifestURL }); break; } } } let IndexedDBPromptHelper = { _quotaPrompt: "indexedDB-quota-prompt", _quotaResponse: "indexedDB-quota-response",