Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/main.js

Issue 29325137: Issue 2950 - Don`t rely on Services.mm, it isn`t available before Gecko 39 (Closed)
Patch Set: Created Aug. 27, 2015, 12:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/composer.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This Source Code is subject to the terms of the Mozilla Public License 2 * This Source Code is subject to the terms of the Mozilla Public License
3 * version 2.0 (the "License"). You can obtain a copy of the License at 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 7 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
8 8
9 let {Prefs} = require("prefs"); 9 let {Prefs} = require("prefs");
10 let {WindowObserver} = require("windowObserver"); 10 let {WindowObserver} = require("windowObserver");
(...skipping 30 matching lines...) Expand all
41 let data = event.target.responseText.replace(/%%CLASS%%/g, elementMarkerClass) ; 41 let data = event.target.responseText.replace(/%%CLASS%%/g, elementMarkerClass) ;
42 let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService (Ci.nsIStyleSheetService); 42 let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService (Ci.nsIStyleSheetService);
43 let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data), null, null); 43 let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data), null, null);
44 styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET ); 44 styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET );
45 onShutdown.add(() => styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetSe rvice.USER_SHEET)); 45 onShutdown.add(() => styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetSe rvice.USER_SHEET));
46 }, false); 46 }, false);
47 request.send(null); 47 request.send(null);
48 48
49 // Load our developer tools actor 49 // Load our developer tools actor
50 let frameScript = "chrome://elemhidehelper/content/frameScript.js?" + elementMar kerClass; 50 let frameScript = "chrome://elemhidehelper/content/frameScript.js?" + elementMar kerClass;
51 Services.mm.loadFrameScript(frameScript, true); 51 let messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
52 .getService(Ci.nsIFrameScriptLoader);
53 messageManager.loadFrameScript(frameScript, true);
52 onShutdown.add(() => { 54 onShutdown.add(() => {
53 Services.mm.removeDelayedFrameScript(frameScript); 55 messageManager.removeDelayedFrameScript(frameScript);
54 Services.mm.broadcastAsyncMessage("ElemHideHelper:Shutdown"); 56 messageManager.QueryInterface(Ci.nsIMessageBroadcaster).broadcastAsyncMessage( "ElemHideHelper:Shutdown");
55 }); 57 });
56 58
57 // Load overlay asynchonously and start attaching to windows once done 59 // Load overlay asynchonously and start attaching to windows once done
58 request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSX MLHttpRequest); 60 request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSX MLHttpRequest);
59 request.open("GET", "chrome://elemhidehelper/content/overlay.xul"); 61 request.open("GET", "chrome://elemhidehelper/content/overlay.xul");
60 request.addEventListener("load", function(event) 62 request.addEventListener("load", function(event)
61 { 63 {
62 if (onShutdown.done) 64 if (onShutdown.done)
63 return; 65 return;
64 66
(...skipping 28 matching lines...) Expand all
93 if (element) 95 if (element)
94 element.parentNode.removeChild(element); 96 element.parentNode.removeChild(element);
95 97
96 for (let child = window.document.firstChild; child; child = child.nextSibl ing) 98 for (let child = window.document.firstChild; child; child = child.nextSibl ing)
97 if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.in dexOf("elemhidehelper-node") >= 0) 99 if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.in dexOf("elemhidehelper-node") >= 0)
98 child.parentNode.removeChild(child); 100 child.parentNode.removeChild(child);
99 } 101 }
100 }); 102 });
101 }, false); 103 }, false);
102 request.send(null); 104 request.send(null);
OLDNEW
« no previous file with comments | « chrome/content/composer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld