b2g/components/test/mochitest/filepicker_path_handler_chrome.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 'use strict';
     7 const Cc = Components.classes;
     8 const Ci = Components.interfaces;
    10 // use ppmm to handle file-picker message.
    11 let ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1']
    12              .getService(Ci.nsIMessageListenerManager);
    14 let pickResult = null;
    16 function processPickMessage(message) {
    17   let sender = message.target.QueryInterface(Ci.nsIMessageSender);
    18   // reply FilePicker's message
    19   sender.sendAsyncMessage('file-picked', pickResult);
    20   // notify caller
    21   sendAsyncMessage('file-picked-posted', { type: 'file-picked-posted' });
    22 }
    24 function updatePickResult(result) {
    25   pickResult = result;
    26   sendAsyncMessage('pick-result-updated', { type: 'pick-result-updated' });
    27 }
    29 ppmm.addMessageListener('file-picker', processPickMessage);
    30 // use update-pick-result to change the expected pick result.
    31 addMessageListener('update-pick-result', updatePickResult);

mercurial