Closed Bug 1362075 Opened 9 years ago Closed 8 years ago

Correct window.open() URL failure exception

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: annevk, Assigned: alchen)

Details

Attachments

(1 file, 2 obsolete files)

Priority: -- → P2
Hi Alphan, would you wanna give it a try? :)
Flags: needinfo?(alchen)
(In reply to Hsin-Yi Tsai (55 Regression Engineering support) [:hsinyi] from comment #1) > Hi Alphan, would you wanna give it a try? :) Sure !
Assignee: nobody → alchen
Flags: needinfo?(alchen)
I tried to run the test. There are four kinds of failures: 1. threw object "Error: Access to 'file:///' from script denied" that is not a DOMException SyntaxError 2. assert_throws: function "() => self.open(test.input).close()" did not throw 3. threw object "[Exception... "The URI is malformed" nsresult: "0x804b000a(NS_ERROR_MALFORMED_URI)" 4. threw object "[Exception... "Unexpected error" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" Currently, I fix some failures of "3. threw NS_ERROR_MALFORMED_URI" by modifying "netwerk/base/nsURLParsers.cpp." Should be able to fix more in urlparser.
For the purposes of this bug you just need to change the exception type. The other failures are tracked by the dependencies of bug 906714, which is a much larger job (for which I'm sure your help is appreciated, if you're interested).
(In reply to Anne (:annevk) from comment #4) > For the purposes of this bug you just need to change the exception type. The > other failures are tracked by the dependencies of bug 906714, which is a > much larger job (for which I'm sure your help is appreciated, if you're > interested). I am sorry that I didn't describe the status clearly. The four kinds of failures I mentioned is only about the test(as below) you added not the whole test cases. self.test(() => { assert_throws("SyntaxError", () => self.open(test.input).close()) }, "window.open(): " + name)
Okay, but even for the tests added you can't fix all without also fixing the URL Standard issue I referenced above. In particular case 2 of comment 3 seems like something that's not really in scope for this bug.
(In reply to Anne (:annevk) from comment #6) > Okay, but even for the tests added you can't fix all without also fixing the > URL Standard issue I referenced above. In particular case 2 of comment 3 > seems like something that's not really in scope for this bug. Yes, you are correct. (In reply to Anne (:annevk) from comment #4) > For the purposes of this bug you just need to change the exception type. I could change the exception type to NS_ERROR_DOM_SYNTAX_ERR in parsing failed case. http://searchfox.org/mozilla-central/source/netwerk/base/nsStandardURL.cpp#1152,1162,1177 By doing this, we still have some failed left. Is this fit your expectation?
Yeah, the other failures are due to the URL parser not returning failure when it should.
Based on the latest specification per comment 1, I change exception type to NS_ERROR_DOM_SYNTAX_ERR. After applying this patch, we can pass more web platform tests.(from 88 to 105) wpt test http://w3c-test.org/url/failure.html
Attachment #8891908 - Flags: review?(valentin.gosu)
Comment on attachment 8891908 [details] [diff] [review] Correct window.open() URL failure exception Review of attachment 8891908 [details] [diff] [review]: ----------------------------------------------------------------- I don't think just changing the return codes is a reliable fix for this issue. That code might change in the future. Maybe what we should do is in nsGlobalWindow::OpenInternal - if NS_NewURI returns an error code, than return NS_ERROR_DOM_SYNTAX_ERR instead of whatever the value of rv is.
Attachment #8891908 - Flags: review?(valentin.gosu) → review-
(In reply to Valentin Gosu [:valentin] from comment #10) > Comment on attachment 8891908 [details] [diff] [review] > Correct window.open() URL failure exception > > Review of attachment 8891908 [details] [diff] [review]: > ----------------------------------------------------------------- > > I don't think just changing the return codes is a reliable fix for this > issue. That code might change in the future. > Maybe what we should do is in nsGlobalWindow::OpenInternal - if NS_NewURI > returns an error code, than return NS_ERROR_DOM_SYNTAX_ERR instead of > whatever the value of rv is. hmm, make sense. Thanks for your help.
With this patch, we can fix some wpt tests of window.open. wpt test http://w3c-test.org/url/failure.html
Attachment #8891908 - Attachment is obsolete: true
Attachment #8892804 - Flags: review?(ehsan)
Attachment #8892804 - Flags: review?(ehsan) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/4ac10df9a0d0 Correct window.open() URL failure exception. r=ehsan
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: