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

Side by Side Diff: lib/inspectorObserver.js

Issue 29357569: Issue 4533 - Don't rely on the default namespace to be XUL for DevTools (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Patch Set: Created Oct. 17, 2016, 9 a.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 | « no previous file | 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 InspectorObserver = 7 let InspectorObserver =
8 { 8 {
9 init: function() 9 init: function()
10 { 10 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 let insertBefore = inspectorToolbar.firstChild; 55 let insertBefore = inspectorToolbar.firstChild;
56 let inspectorAddButton = panelWindow.document.getElementById("inspector-elem ent-add-button"); 56 let inspectorAddButton = panelWindow.document.getElementById("inspector-elem ent-add-button");
57 if (inspectorAddButton && inspectorAddButton.parentNode == inspectorToolbar) 57 if (inspectorAddButton && inspectorAddButton.parentNode == inspectorToolbar)
58 { 58 {
59 // Firefox 48+ 59 // Firefox 48+
60 insertBefore = inspectorAddButton.nextSibling; 60 insertBefore = inspectorAddButton.nextSibling;
61 } 61 }
62 62
63 let tooltiptext = InspectorObserver.inspectorButtonTooltip; 63 let tooltiptext = InspectorObserver.inspectorButtonTooltip;
64 let button = panelWindow.document.createElement("toolbarbutton"); 64 let button = panelWindow.document.createElementNS(
65 "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
saroyanm 2016/10/17 12:02:09 LGTM
66 "toolbarbutton"
67 );
65 button.setAttribute("id", "ehh-inspector-toolbarbutton"); 68 button.setAttribute("id", "ehh-inspector-toolbarbutton");
66 button.setAttribute("class", "devtools-toolbarbutton"); 69 button.setAttribute("class", "devtools-toolbarbutton");
67 button.setAttribute("tooltiptext", tooltiptext); 70 button.setAttribute("tooltiptext", tooltiptext);
68 button.setAttribute("tabindex", "0"); 71 button.setAttribute("tabindex", "0");
69 button.addEventListener("command", () => 72 button.addEventListener("command", () =>
70 { 73 {
71 let node = panel.selection.nodeFront; 74 let node = panel.selection.nodeFront;
72 let target = panel.target; 75 let target = panel.target;
73 if (node && target.form.elemhidehelper) 76 if (node && target.form.elemhidehelper)
74 { 77 {
(...skipping 14 matching lines...) Expand all
89 92
90 //Override button style for light DevTools theme 93 //Override button style for light DevTools theme
91 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet ", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"'); 94 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet ", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"');
92 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); 95 panelWindow.document.insertBefore(style, panelWindow.document.firstChild);
93 96
94 inspectorToolbar.insertBefore(button, insertBefore); 97 inspectorToolbar.insertBefore(button, insertBefore);
95 } 98 }
96 }; 99 };
97 100
98 InspectorObserver.init(); 101 InspectorObserver.init();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld