blob: 51544bb191f21f28964a7dff18b4c7e32b127959 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var RemoteDebugger = (function() {
return {
init: function() {
window.addEventListener('mozChromeEvent', this);
},
handleEvent: function onMozChromeEvent(e) {
if (e.detail.type !== 'remote-debugger-prompt') {
return;
}
// Reusing the ModalDialog infrastructure.
ModalDialog.showWithPseudoEvent({
text: navigator.mozL10n.get('remoteDebuggerMessage'),
type: 'confirm',
callback: function() {
RemoteDebugger._dispatchEvent(true);
},
cancel: function() {
RemoteDebugger._dispatchEvent(false);
}
});
},
_dispatchEvent: function su_dispatchEvent(value) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('mozContentEvent', true, true,
{ type: 'remote-debugger-prompt',
value: value });
window.dispatchEvent(event);
}
};
})();
RemoteDebugger.init();
|