dom/audiochannel/tests/AudioChannelChromeScript.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/audiochannel/tests/AudioChannelChromeScript.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
     1.8 +const { Services } = Cu.import('resource://gre/modules/Services.jsm');
     1.9 +const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm');
    1.10 +
    1.11 +addMessageListener('init-chrome-event', function(message) {
    1.12 +  // listen mozChromeEvent and forward to content process.
    1.13 +  let type = message.type;
    1.14 +
    1.15 +  SystemAppProxy.addEventListener('mozChromeEvent', function(event) {
    1.16 +    let details = event.detail;
    1.17 +    if (details.type === type) {
    1.18 +      sendAsyncMessage('chrome-event', details);
    1.19 +    }
    1.20 +  }, true);
    1.21 +});

mercurial