Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 400331

Summary: [FF] Illegal constructor in URL-shim.js
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ClientAssignee: Simon Kaegi <simon_kaegi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mamacdon, simon_kaegi
Version: unspecified   
Target Milestone: 2.0 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Arthorne CLA 2013-02-08 11:19:07 EST
Seen in I20130208-1010 on orion.eclipse org and orionode 0.0.12 from npm.
Running Firefox 19.0 latest in beta channel.

If I configure Firebug to halt on errors, it halts on URL-shim.js line 17:

Illegal constructor.

if (typeof window.URL === "function" && new window.URL("http://www.w3.org").protocol === "http:") {

I don't know if this is a valid complaint, but it's annoying because it always halts on this when I'm trying to chase down an unrelated bug.
Comment 1 Simon Kaegi CLA 2013-02-08 12:01:18 EST
I guess we could remember the decision in localstorage...
Comment 2 Mark Macdonald CLA 2013-02-11 13:17:37 EST
I guess we could try checking 
> typeof window.URL === "function" && URL.length > 1

to decide whether the 2-argument URL constructor exists, before trying to invoke it. But I'm not sure if host object constructors like URL are guaranteed to have a meaningful "length" property so maybe this won't work.
Comment 3 Simon Kaegi CLA 2013-02-11 14:25:12 EST
Nice simple idea Mark.
I've added "URL.length !== 0" to the check as I think that is the most conservative and matches the latest for both Chrome and FF. Incidentally, for IE10 typeof URL is "object" so this is caught earlier.

Mark reviewed.