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 // | 7 // |
8 // Report data template, more data will be added during data collection | 8 // Report data template, more data will be added during data collection |
9 // | 9 // |
10 | 10 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 type: entry.typeDescr, | 201 type: entry.typeDescr, |
202 docDomain: entry.docDomain, | 202 docDomain: entry.docDomain, |
203 thirdParty: entry.thirdParty, | 203 thirdParty: entry.thirdParty, |
204 count: 1 | 204 count: 1 |
205 }); | 205 }); |
206 } | 206 } |
207 | 207 |
208 // Location is meaningless for element hiding hits | 208 // Location is meaningless for element hiding hits |
209 if (entry.filter && entry.filter instanceof ElemHideBase) | 209 if (entry.filter && entry.filter instanceof ElemHideBase) |
210 requestXML.removeAttribute("location"); | 210 requestXML.removeAttribute("location"); |
211 | 211 |
212 if (entry.filter) | 212 if (entry.filter) |
213 requestXML.setAttribute("filter", entry.filter.text); | 213 requestXML.setAttribute("filter", entry.filter.text); |
214 | 214 |
215 if (node instanceof Element) | 215 if (node instanceof Element) |
216 { | 216 { |
217 requestXML.setAttribute("node", (node.namespaceURI ? node.namespaceURI +
"#" : "") + node.localName); | 217 requestXML.setAttribute("node", (node.namespaceURI ? node.namespaceURI +
"#" : "") + node.localName); |
218 | 218 |
219 try | 219 try |
220 { | 220 { |
221 requestXML.setAttribute("size", node.offsetWidth + "x" + node.offsetHe
ight); | 221 requestXML.setAttribute("size", node.offsetWidth + "x" + node.offsetHe
ight); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 this._canvas = E("screenshotCanvas"); | 326 this._canvas = E("screenshotCanvas"); |
327 this._canvas.width = this._canvas.offsetWidth; | 327 this._canvas.width = this._canvas.offsetWidth; |
328 | 328 |
329 // Do not resize canvas any more (no idea why Gecko requires both to be set) | 329 // Do not resize canvas any more (no idea why Gecko requires both to be set) |
330 this._canvas.parentNode.style.MozBoxAlign = "center"; | 330 this._canvas.parentNode.style.MozBoxAlign = "center"; |
331 this._canvas.parentNode.align = "center"; | 331 this._canvas.parentNode.align = "center"; |
332 | 332 |
333 this._context = this._canvas.getContext("2d"); | 333 this._context = this._canvas.getContext("2d"); |
334 let wndWidth = wnd.document.documentElement.scrollWidth; | 334 let wndWidth = wnd.document.documentElement.scrollWidth; |
335 let wndHeight = wnd.document.documentElement.scrollHeight; | 335 let wndHeight = wnd.document.documentElement.scrollHeight; |
336 | 336 |
337 // Copy scaled screenshot of the webpage. We scale the webpage by width | 337 // Copy scaled screenshot of the webpage. We scale the webpage by width |
338 // but leave 10px on each side for easier selecting. | 338 // but leave 10px on each side for easier selecting. |
339 | 339 |
340 // Gecko doesn't like sizes more than 64k, restrict to 30k to be on the safe
side. | 340 // Gecko doesn't like sizes more than 64k, restrict to 30k to be on the safe
side. |
341 // Also, make sure height is at most five times the width to keep image size
down. | 341 // Also, make sure height is at most five times the width to keep image size
down. |
342 let copyWidth = Math.min(wndWidth, 30000); | 342 let copyWidth = Math.min(wndWidth, 30000); |
343 let copyHeight = Math.min(wndHeight, 30000, copyWidth * 5); | 343 let copyHeight = Math.min(wndHeight, 30000, copyWidth * 5); |
344 let copyX = Math.max(Math.min(wnd.scrollX - copyWidth / 2, wndWidth - copyWi
dth), 0); | 344 let copyX = Math.max(Math.min(wnd.scrollX - copyWidth / 2, wndWidth - copyWi
dth), 0); |
345 let copyY = Math.max(Math.min(wnd.scrollY - copyHeight / 2, wndHeight - copy
Height), 0); | 345 let copyY = Math.max(Math.min(wnd.scrollY - copyHeight / 2, wndHeight - copy
Height), 0); |
346 | 346 |
347 let scalingFactor = (this._canvas.width - this.imageOffset * 2) / copyWidth; | 347 let scalingFactor = (this._canvas.width - this.imageOffset * 2) / copyWidth; |
348 this._canvas.height = copyHeight * scalingFactor + this.imageOffset * 2; | 348 this._canvas.height = copyHeight * scalingFactor + this.imageOffset * 2; |
349 | 349 |
350 this._context.save(); | 350 this._context.save(); |
351 this._context.translate(this.imageOffset, this.imageOffset); | 351 this._context.translate(this.imageOffset, this.imageOffset); |
352 this._context.scale(scalingFactor, scalingFactor); | 352 this._context.scale(scalingFactor, scalingFactor); |
353 this._context.drawWindow(wnd, copyX, copyY, copyWidth, copyHeight, "rgb(255,
255,255)"); | 353 this._context.drawWindow(wnd, copyX, copyY, copyWidth, copyHeight, "rgb(255,
255,255)"); |
354 this._context.restore(); | 354 this._context.restore(); |
355 | 355 |
356 // Init canvas settings | 356 // Init canvas settings |
357 this._context.fillStyle = "rgb(0, 0, 0)"; | 357 this._context.fillStyle = "rgb(0, 0, 0)"; |
358 this._context.strokeStyle = "rgba(255, 0, 0, 0.7)"; | 358 this._context.strokeStyle = "rgba(255, 0, 0, 0.7)"; |
359 this._context.lineWidth = 3; | 359 this._context.lineWidth = 3; |
360 this._context.lineJoin = "round"; | 360 this._context.lineJoin = "round"; |
361 | 361 |
362 // Reduce colors asynchronously | 362 // Reduce colors asynchronously |
363 this._pixelData = this._context.getImageData(this.imageOffset, this.imageOff
set, | 363 this._pixelData = this._context.getImageData(this.imageOffset, this.imageOff
set, |
364 this._canvas.width - this.imageOffset * 2, | 364 this._canvas.width - this.imageOffset * 2, |
365 this._canvas.height - this.imageOffset * 2
); | 365 this._canvas.height - this.imageOffset * 2
); |
366 this._max = this._pixelData.width * this._pixelData.height * 4; | 366 this._max = this._pixelData.width * this._pixelData.height * 4; |
367 this._i = 0; | 367 this._i = 0; |
368 Utils.threadManager.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATCH_
NORMAL); | 368 Utils.threadManager.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATCH_
NORMAL); |
369 }, | 369 }, |
370 | 370 |
371 run: function() | 371 run: function() |
(...skipping 28 matching lines...) Expand all Loading... |
400 E("screenshotMarkButton").disabled = !this._enabled; | 400 E("screenshotMarkButton").disabled = !this._enabled; |
401 E("screenshotRemoveButton").disabled = !this._enabled; | 401 E("screenshotRemoveButton").disabled = !this._enabled; |
402 E("screenshotUndoButton").disabled = !this._enabled || !this._undoQueue.leng
th; | 402 E("screenshotUndoButton").disabled = !this._enabled || !this._undoQueue.leng
th; |
403 }, | 403 }, |
404 | 404 |
405 get selectionType() this._selectionType, | 405 get selectionType() this._selectionType, |
406 set selectionType(type) | 406 set selectionType(type) |
407 { | 407 { |
408 if (this._selectionType == type) | 408 if (this._selectionType == type) |
409 return; | 409 return; |
410 | 410 |
411 // Abort selection already in progress | 411 // Abort selection already in progress |
412 this.abortSelection(); | 412 this.abortSelection(); |
413 | 413 |
414 this._selectionType = type; | 414 this._selectionType = type; |
415 }, | 415 }, |
416 | 416 |
417 exportData: function() | 417 exportData: function() |
418 { | 418 { |
419 removeReportElement("screenshot"); | 419 removeReportElement("screenshot"); |
420 if (this.enabled) | 420 if (this.enabled) |
421 { | 421 { |
422 appendElement(reportData.documentElement, "screenshot", { | 422 appendElement(reportData.documentElement, "screenshot", { |
423 edited: (this._undoQueue.length ? 'true' : 'false') | 423 edited: (this._undoQueue.length ? 'true' : 'false') |
424 }, this._canvas.toDataURL()); | 424 }, this._canvas.toDataURL()); |
425 } | 425 } |
426 }, | 426 }, |
(...skipping 12 matching lines...) Expand all Loading... |
439 | 439 |
440 handleKeyPress: function(event) | 440 handleKeyPress: function(event) |
441 { | 441 { |
442 if (event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE) | 442 if (event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE) |
443 { | 443 { |
444 event.stopPropagation(); | 444 event.stopPropagation(); |
445 event.preventDefault(); | 445 event.preventDefault(); |
446 screenshotDataSource.abortSelection(); | 446 screenshotDataSource.abortSelection(); |
447 } | 447 } |
448 }, | 448 }, |
449 | 449 |
450 startSelection: function(event) | 450 startSelection: function(event) |
451 { | 451 { |
452 if (event.button == 2) | 452 if (event.button == 2) |
453 this.abortSelection(); // Right mouse button aborts selection | 453 this.abortSelection(); // Right mouse button aborts selection |
454 | 454 |
455 if (event.button != 0 || !this.enabled) | 455 if (event.button != 0 || !this.enabled) |
456 return; | 456 return; |
457 | 457 |
458 // Abort selection already in progress | 458 // Abort selection already in progress |
459 this.abortSelection(); | 459 this.abortSelection(); |
460 | 460 |
461 let boxObject = document.getBoxObjectFor(this._canvas); | 461 let boxObject = document.getBoxObjectFor(this._canvas); |
462 let [x, y] = [event.screenX - boxObject.screenX, event.screenY - boxObject.s
creenY]; | 462 let [x, y] = [event.screenX - boxObject.screenX, event.screenY - boxObject.s
creenY]; |
463 this._currentData = { | 463 this._currentData = { |
464 data: null, | 464 data: null, |
465 anchorX: x, | 465 anchorX: x, |
466 anchorY: y, | 466 anchorY: y, |
467 currentX: -1, | 467 currentX: -1, |
468 currentY: -1 | 468 currentY: -1 |
469 }; | 469 }; |
470 this.updateSelection(event); | 470 this.updateSelection(event); |
471 | 471 |
472 document.addEventListener("keypress", this.handleKeyPress, true); | 472 document.addEventListener("keypress", this.handleKeyPress, true); |
473 }, | 473 }, |
474 | 474 |
475 updateSelection: function(event) | 475 updateSelection: function(event) |
476 { | 476 { |
477 if (event.button != 0 || !this._currentData) | 477 if (event.button != 0 || !this._currentData) |
478 return; | 478 return; |
479 | 479 |
480 let boxObject = document.getBoxObjectFor(this._canvas); | 480 let boxObject = document.getBoxObjectFor(this._canvas); |
481 let [x, y] = [event.screenX - boxObject.screenX, event.screenY - boxObject.s
creenY]; | 481 let [x, y] = [event.screenX - boxObject.screenX, event.screenY - boxObject.s
creenY]; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 this._context.strokeRect(left, top, right - left, bottom - top); | 514 this._context.strokeRect(left, top, right - left, bottom - top); |
515 } | 515 } |
516 else if (this._selectionType == "remove") | 516 else if (this._selectionType == "remove") |
517 this._context.fillRect(left, top, right - left, bottom - top); | 517 this._context.fillRect(left, top, right - left, bottom - top); |
518 }, | 518 }, |
519 | 519 |
520 stopSelection: function(event) | 520 stopSelection: function(event) |
521 { | 521 { |
522 if (event.button != 0 || !this._currentData) | 522 if (event.button != 0 || !this._currentData) |
523 return; | 523 return; |
524 | 524 |
525 if (this._currentData.data) | 525 if (this._currentData.data) |
526 { | 526 { |
527 this._undoQueue.push(this._currentData); | 527 this._undoQueue.push(this._currentData); |
528 E("screenshotUndoButton").disabled = false; | 528 E("screenshotUndoButton").disabled = false; |
529 } | 529 } |
530 | 530 |
531 this._currentData = null; | 531 this._currentData = null; |
532 document.removeEventListener("keypress", this.handleKeyPress, true); | 532 document.removeEventListener("keypress", this.handleKeyPress, true); |
533 }, | 533 }, |
534 | 534 |
535 undo: function() | 535 undo: function() |
536 { | 536 { |
537 let op = this._undoQueue.pop(); | 537 let op = this._undoQueue.pop(); |
538 if (!op) | 538 if (!op) |
539 return; | 539 return; |
540 | 540 |
541 this._context.putImageData(op.data, | 541 this._context.putImageData(op.data, |
542 Math.min(op.anchorX, op.currentX), | 542 Math.min(op.anchorX, op.currentX), |
543 Math.min(op.anchorY, op.currentY)); | 543 Math.min(op.anchorY, op.currentY)); |
544 | 544 |
545 if (!this._undoQueue.length) | 545 if (!this._undoQueue.length) |
546 E("screenshotUndoButton").disabled = true; | 546 E("screenshotUndoButton").disabled = true; |
547 } | 547 } |
548 }; | 548 }; |
549 | 549 |
550 let framesDataSource = | 550 let framesDataSource = |
551 { | 551 { |
552 site: null, | 552 site: null, |
553 | 553 |
554 collectData: function(wnd, windowURI, callback) | 554 collectData: function(wnd, windowURI, callback) |
(...skipping 20 matching lines...) Expand all Loading... |
575 callback(); | 575 callback(); |
576 }, | 576 }, |
577 | 577 |
578 scanFrames: function(wnd, xmlList) | 578 scanFrames: function(wnd, xmlList) |
579 { | 579 { |
580 try | 580 try |
581 { | 581 { |
582 for (let i = 0; i < wnd.frames.length; i++) | 582 for (let i = 0; i < wnd.frames.length; i++) |
583 { | 583 { |
584 let frame = wnd.frames[i]; | 584 let frame = wnd.frames[i]; |
585 let frameXML = appendElement(xmllist, "frame", { | 585 let frameXML = appendElement(xmlList, "frame", { |
586 url: censorURL(frame.location.href) | 586 url: censorURL(frame.location.href) |
587 }); | 587 }); |
588 this.scanFrames(frame, frameXML); | 588 this.scanFrames(frame, frameXML); |
589 } | 589 } |
590 } | 590 } |
591 catch (e) | 591 catch (e) |
592 { | 592 { |
593 // Don't break if something goes wrong | 593 // Don't break if something goes wrong |
594 Cu.reportError(e); | 594 Cu.reportError(e); |
595 } | 595 } |
(...skipping 12 matching lines...) Expand all Loading... |
608 messages = messages.value || []; | 608 messages = messages.value || []; |
609 messages = messages.filter(function(message) | 609 messages = messages.filter(function(message) |
610 { | 610 { |
611 return (message instanceof Ci.nsIScriptError && | 611 return (message instanceof Ci.nsIScriptError && |
612 !/^https?:/i.test(message.sourceName) && | 612 !/^https?:/i.test(message.sourceName) && |
613 (/adblock/i.test(message.errorMessage) || /adblock/i.test(message.sour
ceName) || | 613 (/adblock/i.test(message.errorMessage) || /adblock/i.test(message.sour
ceName) || |
614 message.errorMessage.indexOf(addonID) >= 0 || message.sourceName.inde
xOf(addonID) >= 0)); | 614 message.errorMessage.indexOf(addonID) >= 0 || message.sourceName.inde
xOf(addonID) >= 0)); |
615 }); | 615 }); |
616 if (messages.length > 10) // Only the last 10 messages | 616 if (messages.length > 10) // Only the last 10 messages |
617 messages = messages.slice(messages.length - 10, messages.length); | 617 messages = messages.slice(messages.length - 10, messages.length); |
618 | 618 |
619 // Censor app and profile paths in error messages | 619 // Censor app and profile paths in error messages |
620 let censored = {__proto__: null}; | 620 let censored = {__proto__: null}; |
621 let pathList = [["ProfD", "%PROFILE%"], ["GreD", "%GRE%"], ["CurProcD", "%AP
P%"]]; | 621 let pathList = [["ProfD", "%PROFILE%"], ["GreD", "%GRE%"], ["CurProcD", "%AP
P%"]]; |
622 for (let i = 0; i < pathList.length; i++) | 622 for (let i = 0; i < pathList.length; i++) |
623 { | 623 { |
624 let [pathID, placeholder] = pathList[i]; | 624 let [pathID, placeholder] = pathList[i]; |
625 try | 625 try |
626 { | 626 { |
627 let file = FileUtils.getDir(pathID, [], false); | 627 let file = FileUtils.getDir(pathID, [], false); |
628 censored[file.path.replace(/[\\\/]+$/, '')] = placeholder; | 628 censored[file.path.replace(/[\\\/]+$/, '')] = placeholder; |
629 let uri = Utils.ioService.newFileURI(file); | 629 let uri = Utils.ioService.newFileURI(file); |
630 censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder; | 630 censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder; |
631 } catch(e) {} | 631 } catch(e) {} |
632 } | 632 } |
633 | 633 |
634 let errors = reportElement("errors"); | 634 let errors = reportElement("errors"); |
635 for (let i = 0; i < messages.length; i++) | 635 for (let i = 0; i < messages.length; i++) |
636 { | 636 { |
637 let message = messages[i]; | 637 let message = messages[i]; |
638 | 638 |
639 let text = message.errorMessage; | 639 let text = message.errorMessage; |
640 for (let path in censored) | 640 for (let path in censored) |
641 text = text.replace(path, censored[path], "gi"); | 641 text = text.replace(path, censored[path], "gi"); |
642 if (text.length > 256) | 642 if (text.length > 256) |
643 text = text.substr(0, 256) + "..."; | 643 text = text.substr(0, 256) + "..."; |
644 | 644 |
645 let file = message.sourceName; | 645 let file = message.sourceName; |
646 for (let path in censored) | 646 for (let path in censored) |
647 file = file.replace(path, censored[path], "gi"); | 647 file = file.replace(path, censored[path], "gi"); |
648 if (file.length > 256) | 648 if (file.length > 256) |
649 file = file.substr(0, 256) + "..."; | 649 file = file.substr(0, 256) + "..."; |
650 | 650 |
651 let sourceLine = message.sourceLine; | 651 let sourceLine = message.sourceLine; |
652 if (sourceLine.length > 256) | 652 if (sourceLine.length > 256) |
653 sourceLine = sourceLine.substr(0, 256) + "..."; | 653 sourceLine = sourceLine.substr(0, 256) + "..."; |
654 | 654 |
655 appendElement(errors, "error", { | 655 appendElement(errors, "error", { |
656 type: message.flags & Ci.nsIScriptError.warningFlag ? "warning" : "error
", | 656 type: message.flags & Ci.nsIScriptError.warningFlag ? "warning" : "error
", |
657 text: text, | 657 text: text, |
658 file: file, | 658 file: file, |
659 line: message.lineNumber, | 659 line: message.lineNumber, |
660 column: message.columnNumber, | 660 column: message.columnNumber, |
661 sourceLine: sourceLine | 661 sourceLine: sourceLine |
662 }); | 662 }); |
663 } | 663 } |
664 | 664 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 this.whitelistFilter = Policy.isWindowWhitelisted(wnd); | 878 this.whitelistFilter = Policy.isWindowWhitelisted(wnd); |
879 | 879 |
880 if (!this.whitelistFilter && this.isEnabled) | 880 if (!this.whitelistFilter && this.isEnabled) |
881 { | 881 { |
882 // Find disabled filters in active subscriptions matching any of the reque
sts | 882 // Find disabled filters in active subscriptions matching any of the reque
sts |
883 let disabledMatcher = new CombinedMatcher(); | 883 let disabledMatcher = new CombinedMatcher(); |
884 for each (let subscription in FilterStorage.subscriptions) | 884 for each (let subscription in FilterStorage.subscriptions) |
885 { | 885 { |
886 if (subscription.disabled) | 886 if (subscription.disabled) |
887 continue; | 887 continue; |
888 | 888 |
889 for each (let filter in subscription.filters) | 889 for each (let filter in subscription.filters) |
890 if (filter instanceof BlockingFilter && filter.disabled) | 890 if (filter instanceof BlockingFilter && filter.disabled) |
891 disabledMatcher.add(filter); | 891 disabledMatcher.add(filter); |
892 } | 892 } |
893 | 893 |
894 let seenFilters = {__proto__: null}; | 894 let seenFilters = {__proto__: null}; |
895 for each (let request in requestsDataSource.origRequests) | 895 for each (let request in requestsDataSource.origRequests) |
896 { | 896 { |
897 if (request.filter) | 897 if (request.filter) |
898 continue; | 898 continue; |
(...skipping 15 matching lines...) Expand all Loading... |
914 | 914 |
915 disabledMatcher.clear(); | 915 disabledMatcher.clear(); |
916 for each (let filter in subscription.filters) | 916 for each (let filter in subscription.filters) |
917 if (filter instanceof BlockingFilter) | 917 if (filter instanceof BlockingFilter) |
918 disabledMatcher.add(filter); | 918 disabledMatcher.add(filter); |
919 | 919 |
920 for each (let request in requestsDataSource.origRequests) | 920 for each (let request in requestsDataSource.origRequests) |
921 { | 921 { |
922 if (request.filter) | 922 if (request.filter) |
923 continue; | 923 continue; |
924 | 924 |
925 let filter = disabledMatcher.matchesAny(request.location, request.type
Descr, request.docDomain, request.thirdParty); | 925 let filter = disabledMatcher.matchesAny(request.location, request.type
Descr, request.docDomain, request.thirdParty); |
926 if (filter && !(subscription.url in seenSubscriptions)) | 926 if (filter && !(subscription.url in seenSubscriptions)) |
927 { | 927 { |
928 this.disabledSubscriptions.push(subscription); | 928 this.disabledSubscriptions.push(subscription); |
929 seenSubscriptions[subscription.text] = true; | 929 seenSubscriptions[subscription.text] = true; |
930 break; | 930 break; |
931 } | 931 } |
932 } | 932 } |
933 } | 933 } |
934 | 934 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 | 1081 |
1082 addSubscription: function() | 1082 addSubscription: function() |
1083 { | 1083 { |
1084 let result = {}; | 1084 let result = {}; |
1085 openDialog("subscriptionSelection.xul", "_blank", "chrome,centerscreen,modal
,resizable,dialog=no", null, result); | 1085 openDialog("subscriptionSelection.xul", "_blank", "chrome,centerscreen,modal
,resizable,dialog=no", null, result); |
1086 if (!("url" in result)) | 1086 if (!("url" in result)) |
1087 return; | 1087 return; |
1088 | 1088 |
1089 let subscriptionResults = [[result.url, result.title]]; | 1089 let subscriptionResults = [[result.url, result.title]]; |
1090 if ("mainSubscriptionURL" in result) | 1090 if ("mainSubscriptionURL" in result) |
1091 subscriptionResults.push([result.mainSubscriptionURL, result.mainSubscript
ionTitle]); | 1091 subscriptionResults.push([result.mainSubscriptionURL, result.mainSubscript
ionTitle]); |
1092 | 1092 |
1093 for each (let [url, title] in subscriptionResults) | 1093 for each (let [url, title] in subscriptionResults) |
1094 { | 1094 { |
1095 let subscription = Subscription.fromURL(url); | 1095 let subscription = Subscription.fromURL(url); |
1096 if (!subscription) | 1096 if (!subscription) |
1097 continue; | 1097 continue; |
1098 | 1098 |
1099 FilterStorage.addSubscription(subscription); | 1099 FilterStorage.addSubscription(subscription); |
1100 | 1100 |
1101 subscription.disabled = false; | 1101 subscription.disabled = false; |
1102 subscription.title = title; | 1102 subscription.title = title; |
1103 | 1103 |
1104 if (subscription instanceof DownloadableSubscription && !subscription.last
Download) | 1104 if (subscription instanceof DownloadableSubscription && !subscription.last
Download) |
1105 Synchronizer.execute(subscription); | 1105 Synchronizer.execute(subscription); |
1106 } | 1106 } |
1107 | 1107 |
1108 E("issuesNoSubscriptionsBox").hidden = true; | 1108 E("issuesNoSubscriptionsBox").hidden = true; |
1109 this.forceReload(); | 1109 this.forceReload(); |
1110 }, | 1110 }, |
1111 | 1111 |
1112 disableFilter: function(node) | 1112 disableFilter: function(node) |
1113 { | 1113 { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 } catch (e) {} | 1450 } catch (e) {} |
1451 | 1451 |
1452 result = result.replace(/%CONFIRMATION%/g, encodeHTML(E("result").getAttribute
("confirmationMessage"))); | 1452 result = result.replace(/%CONFIRMATION%/g, encodeHTML(E("result").getAttribute
("confirmationMessage"))); |
1453 result = result.replace(/%KNOWNISSUE%/g, encodeHTML(E("result").getAttribute("
knownIssueMessage"))); | 1453 result = result.replace(/%KNOWNISSUE%/g, encodeHTML(E("result").getAttribute("
knownIssueMessage"))); |
1454 result = result.replace(/(<html)\b/, '$1 dir="' + window.getComputedStyle(docu
ment.documentElement, "").direction + '"'); | 1454 result = result.replace(/(<html)\b/, '$1 dir="' + window.getComputedStyle(docu
ment.documentElement, "").direction + '"'); |
1455 | 1455 |
1456 if (!success) | 1456 if (!success) |
1457 { | 1457 { |
1458 let errorElement = E("sendReportError"); | 1458 let errorElement = E("sendReportError"); |
1459 let template = errorElement.getAttribute("textTemplate").replace(/[\r\n\s]+/
g, " "); | 1459 let template = errorElement.getAttribute("textTemplate").replace(/[\r\n\s]+/
g, " "); |
1460 | 1460 |
1461 let [, beforeLink, linkText, afterLink] = /(.*)\[link\](.*)\[\/link\](.*)/.e
xec(template) || [null, "", template, ""]; | 1461 let [, beforeLink, linkText, afterLink] = /(.*)\[link\](.*)\[\/link\](.*)/.e
xec(template) || [null, "", template, ""]; |
1462 beforeLink = beforeLink.replace(/\?1\?/g, errorMessage); | 1462 beforeLink = beforeLink.replace(/\?1\?/g, errorMessage); |
1463 afterLink = afterLink.replace(/\?1\?/g, errorMessage); | 1463 afterLink = afterLink.replace(/\?1\?/g, errorMessage); |
1464 | 1464 |
1465 while (errorElement.firstChild && errorElement.firstChild.nodeType != Node.E
LEMENT_NODE) | 1465 while (errorElement.firstChild && errorElement.firstChild.nodeType != Node.E
LEMENT_NODE) |
1466 errorElement.removeChild(errorElement.firstChild); | 1466 errorElement.removeChild(errorElement.firstChild); |
1467 while (errorElement.lastChild && errorElement.lastChild.nodeType != Node.ELE
MENT_NODE) | 1467 while (errorElement.lastChild && errorElement.lastChild.nodeType != Node.ELE
MENT_NODE) |
1468 errorElement.removeChild(errorElement.lastChild); | 1468 errorElement.removeChild(errorElement.lastChild); |
1469 | 1469 |
1470 if (errorElement.firstChild) | 1470 if (errorElement.firstChild) |
1471 errorElement.firstChild.textContent = linkText; | 1471 errorElement.firstChild.textContent = linkText; |
1472 errorElement.insertBefore(document.createTextNode(beforeLink), errorElement.
firstChild); | 1472 errorElement.insertBefore(document.createTextNode(beforeLink), errorElement.
firstChild); |
1473 errorElement.appendChild(document.createTextNode(afterLink)); | 1473 errorElement.appendChild(document.createTextNode(afterLink)); |
1474 | 1474 |
1475 E("sendReportErrorBox").hidden = false; | 1475 E("sendReportErrorBox").hidden = false; |
1476 } | 1476 } |
1477 | 1477 |
1478 E("sendReportProgress").hidden = true; | 1478 E("sendReportProgress").hidden = true; |
1479 | 1479 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 | 1528 |
1529 function censorURL(url) | 1529 function censorURL(url) |
1530 { | 1530 { |
1531 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); | 1531 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); |
1532 } | 1532 } |
1533 | 1533 |
1534 function encodeHTML(str) | 1534 function encodeHTML(str) |
1535 { | 1535 { |
1536 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); | 1536 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); |
1537 } | 1537 } |
OLD | NEW |