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

Delta Between Two Patch Sets: lib/basedomain.js

Issue 5666188336037888: Issue 581 - Fixed element hiding/collapsing in anonymous frames on Chrome (Closed)
Left Patch Set: Created May 30, 2014, 11:32 a.m.
Right Patch Set: Addressed comments Created June 17, 2014, 2:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « include.preload.js ('k') | webrequest.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /*! 1 /*!
2 * Parts of original code from ipv6.js <https://github.com/beaugunderson/javascr ipt-ipv6> 2 * Parts of original code from ipv6.js <https://github.com/beaugunderson/javascr ipt-ipv6>
3 * Copyright 2011 Beau Gunderson 3 * Copyright 2011 Beau Gunderson
4 * Available under MIT license <http://mths.be/mit> 4 * Available under MIT license <http://mths.be/mit>
5 */ 5 */
6 6
7 const RE_V4 = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|0x[0-9a-f][0-9a-f]?|0 [0-7]{3})\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|0x[0-9a-f][0-9a-f]?|0[0-7 ]{3})$/i; 7 const RE_V4 = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|0x[0-9a-f][0-9a-f]?|0 [0-7]{3})\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|0x[0-9a-f][0-9a-f]?|0[0-7 ]{3})$/i;
8 const RE_V4_HEX = /^0x([0-9a-f]{8})$/i; 8 const RE_V4_HEX = /^0x([0-9a-f]{8})$/i;
9 const RE_V4_NUMERIC = /^[0-9]+$/; 9 const RE_V4_NUMERIC = /^[0-9]+$/;
10 const RE_V4inV6 = /(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2 [0-4][0-9]|[01]?[0-9][0-9]?)$/; 10 const RE_V4inV6 = /(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2 [0-4][0-9]|[01]?[0-9][0-9]?)$/;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 { 151 {
152 // Keep the empty string for invalid URIs. 152 // Keep the empty string for invalid URIs.
153 } 153 }
154 154
155 extractHostFromURL._lastURL = url; 155 extractHostFromURL._lastURL = url;
156 extractHostFromURL._lastDomain = host; 156 extractHostFromURL._lastDomain = host;
157 return host; 157 return host;
158 } 158 }
159 159
160 /** 160 /**
161 * Extracts host name from the URL of the given frame. If the URL don't have hos t
162 * information (like about:blank or data: URLs) it falls back to the parent fram e.
163 */
164 function extractHostFromFrame(frame)
165 {
166 var host = extractHostFromURL(frame.url);
167 if (!host)
168 {
169 var parentFrame = frame.parent;
170 if (parentFrame)
171 return extractHostFromFrame(parentFrame);
172 }
173 return host;
174 }
175
176 /**
161 * Strips the fragment from a URL. 177 * Strips the fragment from a URL.
162 */ 178 */
163 function stripFragmentFromURL(/**String*/ url) 179 function stripFragmentFromURL(/**String*/ url)
164 { 180 {
165 return url.replace(/#.*/, ""); 181 return url.replace(/#.*/, "");
166 } 182 }
167 183
168 /** 184 /**
169 * Parses URLs and provides an interface similar to nsIURI in Gecko, see 185 * Parses URLs and provides an interface similar to nsIURI in Gecko, see
170 * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIURI. 186 * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIURI.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 }, 271 },
256 get path() 272 get path()
257 { 273 {
258 return this.spec.substring(this._hostPortEnd); 274 return this.spec.substring(this._hostPortEnd);
259 }, 275 },
260 get prePath() 276 get prePath()
261 { 277 {
262 return this.spec.substring(0, this._hostPortEnd); 278 return this.spec.substring(0, this._hostPortEnd);
263 } 279 }
264 }; 280 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld