| OLD | NEW |
| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 function togglePreview(preview) { | 548 function togglePreview(preview) { |
| 549 if (preview) { | 549 if (preview) { |
| 550 if (!previewStyle || !previewStyle.parentNode) { | 550 if (!previewStyle || !previewStyle.parentNode) { |
| 551 previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "style"
); | 551 previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "style"
); |
| 552 previewStyle.setAttribute("type", "text/css"); | 552 previewStyle.setAttribute("type", "text/css"); |
| 553 doc.documentElement.appendChild(previewStyle); | 553 doc.documentElement.appendChild(previewStyle); |
| 554 } | 554 } |
| 555 previewStyle.textContent = stylesheetData; | 555 previewStyle.textContent = stylesheetData; |
| 556 } | 556 } |
| 557 else { | 557 else { |
| 558 if (previewStyle && previewStyle.parentNode) | 558 try |
| 559 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 } |
| 560 previewStyle = null; | 569 previewStyle = null; |
| 561 } | 570 } |
| 562 } | 571 } |
| 563 | 572 |
| 564 function changeDomain(node) { | 573 function changeDomain(node) { |
| 565 domainData.selected = node.getAttribute("value"); | 574 domainData.selected = node.getAttribute("value"); |
| 566 updateExpression(); | 575 updateExpression(); |
| 567 } | 576 } |
| 568 | 577 |
| 569 function toggleAttr(node) { | 578 function toggleAttr(node) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 | 635 |
| 627 fillAttributes(item.nodeData); | 636 fillAttributes(item.nodeData); |
| 628 } | 637 } |
| 629 | 638 |
| 630 function addExpression() | 639 function addExpression() |
| 631 { | 640 { |
| 632 AdblockPlus.addPatterns([document.getElementById("expression").value]); | 641 AdblockPlus.addPatterns([document.getElementById("expression").value]); |
| 633 | 642 |
| 634 togglePreview(false); | 643 togglePreview(false); |
| 635 } | 644 } |
| OLD | NEW |