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

Side by Side Diff: chrome/content/ui/sendReport.js

Issue 29333312: Issue 3486 - Issue reporter: don`t access content window to reload the page (Closed)
Patch Set: Created Jan. 7, 2016, 7:15 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 | « no previous file | lib/ui.js » ('j') | 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 file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 11 matching lines...) Expand all
22 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 22 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
23 let {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", {}); 23 let {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", {});
24 let {PrivateBrowsingUtils} = Cu.import("resource://gre/modules/PrivateBrowsingUt ils.jsm", {}); 24 let {PrivateBrowsingUtils} = Cu.import("resource://gre/modules/PrivateBrowsingUt ils.jsm", {});
25 25
26 const MILLISECONDS_IN_SECOND = 1000; 26 const MILLISECONDS_IN_SECOND = 1000;
27 const SECONDS_IN_MINUTE = 60; 27 const SECONDS_IN_MINUTE = 60;
28 const SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE; 28 const SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE;
29 const SECONDS_IN_DAY = 24 * SECONDS_IN_HOUR; 29 const SECONDS_IN_DAY = 24 * SECONDS_IN_HOUR;
30 30
31 let contentWindow = window.arguments[0]; 31 let contentWindow = window.arguments[0];
32 let windowURI = (window.arguments[1] instanceof Ci.nsIURI ? window.arguments[1] : null); 32 let windowURI = window.arguments[1];
33 if (typeof windowURI == "string")
34 windowURI = Services.newURI(windowURI, null, null);
35 let browser = window.arguments[2];
33 36
34 let reportData = new DOMParser().parseFromString("<report></report>", "text/xml" ); 37 let reportData = new DOMParser().parseFromString("<report></report>", "text/xml" );
35 38
36 // Some helper functions to work with the report data 39 // Some helper functions to work with the report data
37 function reportElement(tag) 40 function reportElement(tag)
38 { 41 {
39 for (let child = reportData.documentElement.firstChild; child; child = child.n extSibling) 42 for (let child = reportData.documentElement.firstChild; child; child = child.n extSibling)
40 if (child.nodeType == Node.ELEMENT_NODE && child.tagName == tag) 43 if (child.nodeType == Node.ELEMENT_NODE && child.tagName == tag)
41 return child; 44 return child;
42 let element = reportData.createElement(tag); 45 let element = reportData.createElement(tag);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 }; 105 };
103 106
104 // 107 //
105 // Data collectors 108 // Data collectors
106 // 109 //
107 110
108 var reportsListDataSource = 111 var reportsListDataSource =
109 { 112 {
110 list: [], 113 list: [],
111 114
112 collectData: function(wnd, windowURI, callback) 115 collectData: function(wnd, windowURI, browser, callback)
113 { 116 {
114 let data = Prefs.recentReports; 117 let data = Prefs.recentReports;
115 if (data && "length" in data) 118 if (data && "length" in data)
116 { 119 {
117 for (let i = 0; i < data.length; i++) 120 for (let i = 0; i < data.length; i++)
118 { 121 {
119 let entry = data[i]; 122 let entry = data[i];
120 if (typeof entry.reportURL == "string" && entry.reportURL && 123 if (typeof entry.reportURL == "string" && entry.reportURL &&
121 typeof entry.time == "number" && Date.now() - entry.time < 30*24*60* 60*1000) 124 typeof entry.time == "number" && Date.now() - entry.time < 30*24*60* 60*1000)
122 { 125 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 }; 188 };
186 189
187 var requestsDataSource = 190 var requestsDataSource =
188 { 191 {
189 requests: reportElement("requests"), 192 requests: reportElement("requests"),
190 origRequests: [], 193 origRequests: [],
191 requestNotifier: null, 194 requestNotifier: null,
192 callback: null, 195 callback: null,
193 nodeByKey: Object.create(null), 196 nodeByKey: Object.create(null),
194 197
195 collectData: function(wnd, windowURI, callback) 198 collectData: function(wnd, windowURI, browser, callback)
196 { 199 {
197 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) 200 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor)
198 .getInterface(Ci.nsIDOMWindowUtils) 201 .getInterface(Ci.nsIDOMWindowUtils)
199 .outerWindowID; 202 .outerWindowID;
200 this.callback = callback; 203 this.callback = callback;
201 this.requestNotifier = new RequestNotifier(outerWindowID, this.onRequestFoun d, this); 204 this.requestNotifier = new RequestNotifier(outerWindowID, this.onRequestFoun d, this);
202 }, 205 },
203 206
204 onRequestFound: function(entry, scanComplete) 207 onRequestFound: function(entry, scanComplete)
205 { 208 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 this.requestNotifier = null; 242 this.requestNotifier = null;
240 this.callback(); 243 this.callback();
241 } 244 }
242 } 245 }
243 }; 246 };
244 247
245 var filtersDataSource = 248 var filtersDataSource =
246 { 249 {
247 origFilters: [], 250 origFilters: [],
248 251
249 collectData: function(wnd, windowURI, callback) 252 collectData: function(wnd, windowURI, browser, callback)
250 { 253 {
251 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) 254 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor)
252 .getInterface(Ci.nsIDOMWindowUtils) 255 .getInterface(Ci.nsIDOMWindowUtils)
253 .outerWindowID; 256 .outerWindowID;
254 RequestNotifier.getWindowStatistics(outerWindowID, (wndStats) => 257 RequestNotifier.getWindowStatistics(outerWindowID, (wndStats) =>
255 { 258 {
256 if (wndStats) 259 if (wndStats)
257 { 260 {
258 let filters = reportElement("filters"); 261 let filters = reportElement("filters");
259 for (let f in wndStats.filters) 262 for (let f in wndStats.filters)
(...skipping 17 matching lines...) Expand all
277 { 280 {
278 subscriptionFilter: function(s) 281 subscriptionFilter: function(s)
279 { 282 {
280 if (s.disabled || !(s instanceof RegularSubscription)) 283 if (s.disabled || !(s instanceof RegularSubscription))
281 return false; 284 return false;
282 if (s instanceof DownloadableSubscription && !/^(http|https|ftp):/i.test(s.u rl)) 285 if (s instanceof DownloadableSubscription && !/^(http|https|ftp):/i.test(s.u rl))
283 return false; 286 return false;
284 return true; 287 return true;
285 }, 288 },
286 289
287 collectData: function(wnd, windowURI, callback) 290 collectData: function(wnd, windowURI, browser, callback)
288 { 291 {
289 let subscriptions = reportElement("subscriptions"); 292 let subscriptions = reportElement("subscriptions");
290 let now = Math.round(Date.now() / 1000); 293 let now = Math.round(Date.now() / 1000);
291 for (let i = 0; i < FilterStorage.subscriptions.length; i++) 294 for (let i = 0; i < FilterStorage.subscriptions.length; i++)
292 { 295 {
293 let subscription = FilterStorage.subscriptions[i]; 296 let subscription = FilterStorage.subscriptions[i];
294 if (!this.subscriptionFilter(subscription)) 297 if (!this.subscriptionFilter(subscription))
295 continue; 298 continue;
296 299
297 let subscriptionXML = appendElement(subscriptions, "subscription", { 300 let subscriptionXML = appendElement(subscriptions, "subscription", {
(...skipping 14 matching lines...) Expand all
312 subscriptionXML.setAttribute("hardExpiration", subscription.expires - now); 315 subscriptionXML.setAttribute("hardExpiration", subscription.expires - now);
313 subscriptionXML.setAttribute("downloadStatus", subscription.downloadStat us); 316 subscriptionXML.setAttribute("downloadStatus", subscription.downloadStat us);
314 } 317 }
315 } 318 }
316 callback(); 319 callback();
317 } 320 }
318 }; 321 };
319 322
320 var remoteDataSource = 323 var remoteDataSource =
321 { 324 {
322 collectData: function(wnd, windowURI, callback) 325 collectData: function(wnd, windowURI, browser, callback)
323 { 326 {
324 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) 327 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor)
325 .getInterface(Ci.nsIDOMWindowUtils) 328 .getInterface(Ci.nsIDOMWindowUtils)
326 .outerWindowID; 329 .outerWindowID;
327 let dataCollector = require("dataCollector"); 330 let dataCollector = require("dataCollector");
328 let screenshotWidth = screenshotDataSource.getWidth(); 331 let screenshotWidth = screenshotDataSource.getWidth();
329 dataCollector.collectData(outerWindowID, screenshotWidth, data => { 332 dataCollector.collectData(outerWindowID, screenshotWidth, data => {
330 screenshotDataSource.setData(data && data.screenshot); 333 screenshotDataSource.setData(data && data.screenshot);
331 framesDataSource.setData(windowURI, data && data.opener, data && data.refe rrer, data && data.frames); 334 framesDataSource.setData(windowURI, data && data.opener, data && data.refe rrer, data && data.frames);
332 callback(); 335 callback();
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 let frameXML = appendElement(xmlList, "frame", { 576 let frameXML = appendElement(xmlList, "frame", {
574 url: censorURL(frame.url) 577 url: censorURL(frame.url)
575 }); 578 });
576 this.addFrames(frame.frames, frameXML); 579 this.addFrames(frame.frames, frameXML);
577 } 580 }
578 } 581 }
579 }; 582 };
580 583
581 var errorsDataSource = 584 var errorsDataSource =
582 { 585 {
583 collectData: function(wnd, windowURI, callback) 586 collectData: function(wnd, windowURI, browser, callback)
584 { 587 {
585 let {addonID} = require("info"); 588 let {addonID} = require("info");
586 addonID = addonID.replace(/[\{\}]/g, ""); 589 addonID = addonID.replace(/[\{\}]/g, "");
587 590
588 // See https://bugzilla.mozilla.org/show_bug.cgi?id=664695 - starting with 591 // See https://bugzilla.mozilla.org/show_bug.cgi?id=664695 - starting with
589 // Gecko 19 this function returns the result, before that it wrote to a 592 // Gecko 19 this function returns the result, before that it wrote to a
590 // parameter. 593 // parameter.
591 let outparam = {}; 594 let outparam = {};
592 let messages = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleS ervice).getMessageArray(outparam, {}); 595 let messages = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleS ervice).getMessageArray(outparam, {});
593 messages = messages || outparam.value || []; 596 messages = messages || outparam.value || [];
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 651 }
649 652
650 callback(); 653 callback();
651 } 654 }
652 }; 655 };
653 656
654 var extensionsDataSource = 657 var extensionsDataSource =
655 { 658 {
656 data: reportData.createElement("extensions"), 659 data: reportData.createElement("extensions"),
657 660
658 collectData: function(wnd, windowURI, callback) 661 collectData: function(wnd, windowURI, browser, callback)
659 { 662 {
660 try 663 try
661 { 664 {
662 let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm", nu ll).AddonManager; 665 let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm", nu ll).AddonManager;
663 AddonManager.getAddonsByTypes(["extension", "plugin"], function(items) 666 AddonManager.getAddonsByTypes(["extension", "plugin"], function(items)
664 { 667 {
665 for (let i = 0; i < items.length; i++) 668 for (let i = 0; i < items.length; i++)
666 { 669 {
667 let item = items[i]; 670 let item = items[i];
668 if (!item.isActive) 671 if (!item.isActive)
(...skipping 19 matching lines...) Expand all
688 { 691 {
689 if (doExport) 692 if (doExport)
690 reportData.documentElement.appendChild(this.data); 693 reportData.documentElement.appendChild(this.data);
691 else if (this.data.parentNode) 694 else if (this.data.parentNode)
692 this.data.parentNode.removeChild(this.data); 695 this.data.parentNode.removeChild(this.data);
693 } 696 }
694 }; 697 };
695 698
696 var subscriptionUpdateDataSource = 699 var subscriptionUpdateDataSource =
697 { 700 {
698 contentWnd: null, 701 browser: null,
699 type: null, 702 type: null,
700 outdated: null, 703 outdated: null,
701 needUpdate: null, 704 needUpdate: null,
702 705
703 subscriptionFilter: function(s) 706 subscriptionFilter: function(s)
704 { 707 {
705 if (s instanceof DownloadableSubscription) 708 if (s instanceof DownloadableSubscription)
706 return subscriptionsDataSource.subscriptionFilter(s); 709 return subscriptionsDataSource.subscriptionFilter(s);
707 else 710 else
708 return false; 711 return false;
709 }, 712 },
710 713
711 collectData: function(wnd, windowURI, callback) 714 collectData: function(wnd, windowURI, browser, callback)
712 { 715 {
713 this.contentWnd = wnd; 716 this.browser = browser;
714 let now = Date.now() / MILLISECONDS_IN_SECOND; 717 let now = Date.now() / MILLISECONDS_IN_SECOND;
715 let outdatedThreshold = now - 14 * SECONDS_IN_DAY; 718 let outdatedThreshold = now - 14 * SECONDS_IN_DAY;
716 let needUpdateThreshold = now - 1 * SECONDS_IN_HOUR; 719 let needUpdateThreshold = now - 1 * SECONDS_IN_HOUR;
717 720
718 this.outdated = []; 721 this.outdated = [];
719 this.needUpdate = []; 722 this.needUpdate = [];
720 723
721 let subscriptions = FilterStorage.subscriptions.filter(this.subscriptionFilt er); 724 let subscriptions = FilterStorage.subscriptions.filter(this.subscriptionFilt er);
722 for (let i = 0; i < subscriptions.length; i++) 725 for (let i = 0; i < subscriptions.length; i++)
723 { 726 {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 } 797 }
795 798
796 if (filtersRemoved) 799 if (filtersRemoved)
797 { 800 {
798 // Force the user to reload the page 801 // Force the user to reload the page
799 E("updateFixedIssue").hidden = false; 802 E("updateFixedIssue").hidden = false;
800 document.documentElement.canAdvance = true; 803 document.documentElement.canAdvance = true;
801 804
802 let nextButton = document.documentElement.getButton("next"); 805 let nextButton = document.documentElement.getButton("next");
803 [nextButton.label, nextButton.accessKey] = Utils.splitLabel(E("updateP age").getAttribute("reloadButtonLabel")); 806 [nextButton.label, nextButton.accessKey] = Utils.splitLabel(E("updateP age").getAttribute("reloadButtonLabel"));
804 document.documentElement.addEventListener("wizardnext", function(event ) 807 document.documentElement.addEventListener("wizardnext", event =>
805 { 808 {
806 event.preventDefault(); 809 event.preventDefault();
807 event.stopPropagation(); 810 event.stopPropagation();
808 window.close(); 811 window.close();
809 this.contentWnd.location.reload(); 812 this.browser.reload();
Erik 2016/01/08 04:00:45 the only problem I see with this is that the curre
Wladimir Palant 2016/01/08 13:46:20 Given that it is a specific <browser> element rath
810 }.bind(this), true); 813 }, true);
811 } 814 }
812 else 815 else
813 { 816 {
814 this.collectData(null, null, function() {}); 817 this.collectData(null, null, null, function() {});
815 this.needUpdate = []; 818 this.needUpdate = [];
816 if (this.outdated.length) 819 if (this.outdated.length)
817 { 820 {
818 document.documentElement.canRewind = true; 821 document.documentElement.canRewind = true;
819 822
820 this.updatePage(this.type); 823 this.updatePage(this.type);
821 this.showPage(); 824 this.showPage();
822 } 825 }
823 else 826 else
824 { 827 {
(...skipping 21 matching lines...) Expand all
846 849
847 updateOutdated: function() 850 updateOutdated: function()
848 { 851 {
849 for (let i = 0; i < this.outdated.length; i++) 852 for (let i = 0; i < this.outdated.length; i++)
850 Synchronizer.execute(this.outdated[i], true); 853 Synchronizer.execute(this.outdated[i], true);
851 } 854 }
852 } 855 }
853 856
854 var issuesDataSource = 857 var issuesDataSource =
855 { 858 {
856 contentWnd: null, 859 browser: null,
857 isEnabled: Prefs.enabled, 860 isEnabled: Prefs.enabled,
858 whitelistFilter: null, 861 whitelistFilter: null,
859 disabledFilters: [], 862 disabledFilters: [],
860 disabledSubscriptions: [], 863 disabledSubscriptions: [],
861 ownFilters: [], 864 ownFilters: [],
862 numSubscriptions: 0, 865 numSubscriptions: 0,
863 numAppliedFilters: Infinity, 866 numAppliedFilters: Infinity,
864 867
865 subscriptionFilter: function(s) 868 subscriptionFilter: function(s)
866 { 869 {
867 if (s instanceof DownloadableSubscription && 870 if (s instanceof DownloadableSubscription &&
868 s.url != Prefs.subscriptions_exceptionsurl && 871 s.url != Prefs.subscriptions_exceptionsurl &&
869 s.url != Prefs.subscriptions_antiadblockurl) 872 s.url != Prefs.subscriptions_antiadblockurl)
870 { 873 {
871 return subscriptionsDataSource.subscriptionFilter(s); 874 return subscriptionsDataSource.subscriptionFilter(s);
872 } 875 }
873 else 876 else
874 return false; 877 return false;
875 }, 878 },
876 879
877 collectData: function(wnd, windowURI, callback) 880 collectData: function(wnd, windowURI, browser, callback)
878 { 881 {
879 this.contentWnd = wnd; 882 this.browser = browser;
880 this.whitelistFilter = Policy.isWhitelisted(windowURI.spec); 883 this.whitelistFilter = Policy.isWhitelisted(windowURI.spec);
881 884
882 if (!this.whitelistFilter && this.isEnabled) 885 if (!this.whitelistFilter && this.isEnabled)
883 { 886 {
884 // Find disabled filters in active subscriptions matching any of the reque sts 887 // Find disabled filters in active subscriptions matching any of the reque sts
885 let disabledMatcher = new CombinedMatcher(); 888 let disabledMatcher = new CombinedMatcher();
886 for (let subscription of FilterStorage.subscriptions) 889 for (let subscription of FilterStorage.subscriptions)
887 { 890 {
888 if (subscription.disabled) 891 if (subscription.disabled)
889 continue; 892 continue;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1049
1047 forceReload: function() 1050 forceReload: function()
1048 { 1051 {
1049 // User changed configuration, don't allow sending report now - page needs 1052 // User changed configuration, don't allow sending report now - page needs
1050 // to be reloaded 1053 // to be reloaded
1051 E("issuesOverride").hidden = true; 1054 E("issuesOverride").hidden = true;
1052 E("issuesChangeMessage").hidden = false; 1055 E("issuesChangeMessage").hidden = false;
1053 document.documentElement.canRewind = false; 1056 document.documentElement.canRewind = false;
1054 document.documentElement.canAdvance = true; 1057 document.documentElement.canAdvance = true;
1055 1058
1056 let contentWnd = this.contentWnd;
1057 let nextButton = document.documentElement.getButton("next"); 1059 let nextButton = document.documentElement.getButton("next");
1058 [nextButton.label, nextButton.accessKey] = Utils.splitLabel(E("updatePage"). getAttribute("reloadButtonLabel")); 1060 [nextButton.label, nextButton.accessKey] = Utils.splitLabel(E("updatePage"). getAttribute("reloadButtonLabel"));
1059 document.documentElement.addEventListener("wizardnext", function(event) 1061 document.documentElement.addEventListener("wizardnext", event =>
1060 { 1062 {
1061 event.preventDefault(); 1063 event.preventDefault();
1062 event.stopPropagation(); 1064 event.stopPropagation();
1063 window.close(); 1065 window.close();
1064 contentWnd.location.reload(); 1066 this.browser.reload();
1065 }, true); 1067 }, true);
1066 }, 1068 },
1067 1069
1068 removeWhitelist: function() 1070 removeWhitelist: function()
1069 { 1071 {
1070 if (this.whitelistFilter && this.whitelistFilter.subscriptions.length) 1072 if (this.whitelistFilter && this.whitelistFilter.subscriptions.length)
1071 this.whitelistFilter.disabled = true; 1073 this.whitelistFilter.disabled = true;
1072 E("issuesWhitelistBox").hidden = true; 1074 E("issuesWhitelistBox").hidden = true;
1073 this.forceReload(); 1075 this.forceReload();
1074 }, 1076 },
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 { 1228 {
1227 let progressMeter = E("dataCollectorProgress"); 1229 let progressMeter = E("dataCollectorProgress");
1228 progressMeter.mode = "determined"; 1230 progressMeter.mode = "determined";
1229 progressMeter.value = progress; 1231 progressMeter.value = progress;
1230 } 1232 }
1231 1233
1232 // Continue with the next data source, asynchronously to allow progress mete r to update 1234 // Continue with the next data source, asynchronously to allow progress mete r to update
1233 let dataSource = dataCollectors.shift(); 1235 let dataSource = dataCollectors.shift();
1234 Utils.runAsync(function() 1236 Utils.runAsync(function()
1235 { 1237 {
1236 dataSource.collectData(contentWindow, windowURI, initNextDataSource); 1238 dataSource.collectData(contentWindow, windowURI, browser, initNextDataSour ce);
1237 }); 1239 });
1238 }; 1240 };
1239 1241
1240 initNextDataSource(); 1242 initNextDataSource();
1241 } 1243 }
1242 1244
1243 function initTypeSelectorPage() 1245 function initTypeSelectorPage()
1244 { 1246 {
1245 E("progressBar").activeItem = E("typeSelectorHeader"); 1247 E("progressBar").activeItem = E("typeSelectorHeader");
1246 let header = document.getAnonymousElementByAttribute(document.documentElement, "class", "wizard-header"); 1248 let header = document.getAnonymousElementByAttribute(document.documentElement, "class", "wizard-header");
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1551
1550 function censorURL(url) 1552 function censorURL(url)
1551 { 1553 {
1552 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1554 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1553 } 1555 }
1554 1556
1555 function encodeHTML(str) 1557 function encodeHTML(str)
1556 { 1558 {
1557 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1559 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1558 } 1560 }
OLDNEW
« no previous file with comments | « no previous file | lib/ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld