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

Delta Between Two Patch Sets: lib/utils.js

Issue 29339346: Noissue - Removed obsolete nsIURI compatbility code (Closed)
Left Patch Set: Created April 4, 2016, 11:20 a.m.
Right Patch Set: Completly remove Utils.makeURI() Created April 4, 2016, 1:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/compat.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 get appLocale() 45 get appLocale()
46 { 46 {
47 var locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); 47 var locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-");
48 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); 48 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true});
49 return this.appLocale; 49 return this.appLocale;
50 }, 50 },
51 generateChecksum: function(lines) 51 generateChecksum: function(lines)
52 { 52 {
53 // We cannot calculate MD5 checksums yet :-( 53 // We cannot calculate MD5 checksums yet :-(
54 return null; 54 return null;
55 },
56 makeURI: function(url)
57 {
58 let urlObj;
59 try
60 {
61 urlObj = new URL(url);
62 }
63 catch (e)
Sebastian Noack 2016/04/04 11:22:26 We previously didn't handle exceptions here, but w
64 {
65 return null;
66 }
67
68 return {
69 spec: urlObj.href,
70 scheme: urlObj.protocol,
71 host: urlObj.hostname
72 };
73 }, 55 },
74 checkLocalePrefixMatch: function(prefixes) 56 checkLocalePrefixMatch: function(prefixes)
75 { 57 {
76 if (!prefixes) 58 if (!prefixes)
77 return null; 59 return null;
78 60
79 var list = prefixes.split(","); 61 var list = prefixes.split(",");
80 for (var i = 0; i < list.length; i++) 62 for (var i = 0; i < list.length; i++)
81 if (new RegExp("^" + list[i] + "\\b").test(this.appLocale)) 63 if (new RegExp("^" + list[i] + "\\b").test(this.appLocale))
82 return list[i]; 64 return list[i];
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 { 109 {
128 var Prefs = require("prefs").Prefs; 110 var Prefs = require("prefs").Prefs;
129 var docLink = Prefs.documentation_link; 111 var docLink = Prefs.documentation_link;
130 return docLink.replace(/%LINK%/g, linkID).replace(/%LANG%/g, Utils.appLocale ); 112 return docLink.replace(/%LINK%/g, linkID).replace(/%LANG%/g, Utils.appLocale );
131 }, 113 },
132 114
133 yield: function() 115 yield: function()
134 { 116 {
135 } 117 }
136 }; 118 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld