Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 function debug(str) {
8 dump("CHROME PERMISSON HANDLER -- " + str + "\n");
9 }
11 const Cc = Components.classes;
12 const Ci = Components.interfaces;
13 const Cu = Components.utils;
15 const { Services } = Cu.import("resource://gre/modules/Services.jsm");
16 const { SystemAppProxy } = Cu.import("resource://gre/modules/SystemAppProxy.jsm");
18 let eventHandler = function(evt) {
19 if (!evt.detail || evt.detail.type !== "permission-prompt") {
20 return;
21 }
23 sendAsyncMessage("permission-request", evt.detail);
24 };
26 SystemAppProxy.addEventListener("mozChromeEvent", eventHandler);
28 // need to remove ChromeEvent listener after test finished.
29 addMessageListener("teardown", function() {
30 SystemAppProxy.removeEventListener("mozChromeEvent", eventHandler);
31 });
33 addMessageListener("permission-response", function(detail) {
34 SystemAppProxy._sendCustomEvent('mozContentEvent', detail);
35 });