Changes between Version 13 and Version 14 of Ticket #7296


Ignore:
Timestamp:
02/23/2019 08:46:47 AM (7 months ago)
Author:
mjethani
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7296

    • Property Priority changed from Unknown to P2
    • Property Ready set
  • Ticket #7296 – Description

    v13 v14  
    77}}} 
    88 
     9Note: This would work only for URLs that are already canonicalized (i.e. `http:example.com:80?foo` has been converted to `http://example.com/?foo`), such as those received by the [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onBeforeRequest onBeforeRequest] handler in the extension. 
     10 
    911=== What to change === 
    10 To be determined. 
     12Implement a function `parseURL()` that uses the above regular expression to extract the protocol and the hostname from a URL. It should return an object containing the properties `href`, `protocol`, and `hostname` and a `toString()` method that returns the value of the `href` property. `parseURL(url).toString() == new URL(url).toString()` should be `true`. 
    1113 
    12 See [https://codereview.adblockplus.org/30013574/ patch]. 
     14For the tests, pick up some ideas [https://cs.chromium.org/chromium/src/url/gurl_unittest.cc?rcl=9ec7bc85e0f6a0bf28eff6b2eca678067da547e9 from Chromium]. Note however that `parseURL()` should expect an already canonicalized URL; accordingly, the tests should use only canonicalized URLs.