Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 {Prefs} = require("prefs"); | 7 let {Prefs} = require("prefs"); |
8 | 8 |
9 let domainData; | 9 let domainData; |
10 let nodeData; | 10 let nodeData; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 } | 128 } |
129 | 129 |
130 /********************* | 130 /********************* |
131 * General functions * | 131 * General functions * |
132 *********************/ | 132 *********************/ |
133 | 133 |
134 function init() { | 134 function init() { |
135 var element = window.arguments[0]; | 135 var element = window.arguments[0]; |
136 doc = element.ownerDocument; | 136 doc = element.ownerDocument; |
137 var wnd = doc.defaultView; | 137 var wnd = doc.defaultView; |
138 wnd.addEventListener("unload", function(event){ togglePreview(false); }, true) ; | |
Wladimir Palant
2012/11/08 10:42:34
So togglePreview() is the issue? Then this is the
Andrey Novikov
2012/11/08 10:54:54
Exact issue is that previewStyle is dead object af
| |
139 | 138 |
140 // Check whether element hiding group is disabled | 139 // Check whether element hiding group is disabled |
141 let subscription = AdblockPlus.getSubscription("~eh~"); | 140 let subscription = AdblockPlus.getSubscription("~eh~"); |
142 if (subscription && subscription.disabled) | 141 if (subscription && subscription.disabled) |
143 { | 142 { |
144 let warning = document.getElementById("groupDisabledWarning"); | 143 let warning = document.getElementById("groupDisabledWarning"); |
145 if (/\?1\?/.test(warning.textContent)) | 144 if (/\?1\?/.test(warning.textContent)) |
146 warning.textContent = warning.textContent.replace(/\?1\?/g, subscription.t itle); | 145 warning.textContent = warning.textContent.replace(/\?1\?/g, subscription.t itle); |
147 warning.hidden = false; | 146 warning.hidden = false; |
148 } | 147 } |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 function togglePreview(preview) { | 548 function togglePreview(preview) { |
550 if (preview) { | 549 if (preview) { |
551 if (!previewStyle || !previewStyle.parentNode) { | 550 if (!previewStyle || !previewStyle.parentNode) { |
552 previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "style" ); | 551 previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "style" ); |
553 previewStyle.setAttribute("type", "text/css"); | 552 previewStyle.setAttribute("type", "text/css"); |
554 doc.documentElement.appendChild(previewStyle); | 553 doc.documentElement.appendChild(previewStyle); |
555 } | 554 } |
556 previewStyle.textContent = stylesheetData; | 555 previewStyle.textContent = stylesheetData; |
557 } | 556 } |
558 else { | 557 else { |
559 if (previewStyle && previewStyle.parentNode) | 558 try |
560 previewStyle.parentNode.removeChild(previewStyle); | 559 { |
560 if (previewStyle && previewStyle.parentNode) | |
561 previewStyle.parentNode.removeChild(previewStyle); | |
562 } | |
563 catch (e) | |
564 { | |
565 // if the window was closed (reloaded) we end up with dead object referenc e | |
566 // https://bugzilla.mozilla.org/show_bug.cgi?id=695480 | |
567 // just ignore this case | |
568 } | |
561 previewStyle = null; | 569 previewStyle = null; |
562 } | 570 } |
563 } | 571 } |
564 | 572 |
565 function changeDomain(node) { | 573 function changeDomain(node) { |
566 domainData.selected = node.getAttribute("value"); | 574 domainData.selected = node.getAttribute("value"); |
567 updateExpression(); | 575 updateExpression(); |
568 } | 576 } |
569 | 577 |
570 function toggleAttr(node) { | 578 function toggleAttr(node) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 | 635 |
628 fillAttributes(item.nodeData); | 636 fillAttributes(item.nodeData); |
629 } | 637 } |
630 | 638 |
631 function addExpression() | 639 function addExpression() |
632 { | 640 { |
633 AdblockPlus.addPatterns([document.getElementById("expression").value]); | 641 AdblockPlus.addPatterns([document.getElementById("expression").value]); |
634 | 642 |
635 togglePreview(false); | 643 togglePreview(false); |
636 } | 644 } |
LEFT | RIGHT |