Closed
Bug 926890
Opened 12 years ago
Closed 12 years ago
Throw JavaScript exceptions for URL
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: annevk, Assigned: baku)
References
()
Details
(Keywords: dev-doc-needed)
Attachments
(1 file, 2 obsolete files)
|
7.17 KB,
patch
|
Details | Diff | Splinter Review |
DOM exceptions are unstable and using TypeError exclusively here is fine and will allow us to more easily move URL into JavaScript if we decide we want that at some point in the far far future.
| Reporter | ||
Comment 1•12 years ago
|
||
As part of this bug we should also consider start throwing for URL.href (not <a>.href and such) as per https://www.w3.org/Bugs/Public/show_bug.cgi?id=23425 I can file a separate bug if desired, but both are fairly minor.
| Assignee | ||
Comment 2•12 years ago
|
||
Attachment #817252 -
Flags: review?(ehsan)
Comment 3•12 years ago
|
||
Comment on attachment 817252 [details] [diff] [review]
exceptions.patch
Review of attachment 817252 [details] [diff] [review]:
-----------------------------------------------------------------
Can you please add a similar test for the worker APIs to ensure our sanity? r=me with that.
Attachment #817252 -
Flags: review?(ehsan) → review+
| Assignee | ||
Comment 4•12 years ago
|
||
testing it on try.
Attachment #817252 -
Attachment is obsolete: true
Comment 5•12 years ago
|
||
Comment on attachment 817648 [details] [diff] [review]
exceptions.patch
>+++ b/dom/base/URL.cpp
>@@ -186,17 +186,33 @@ URL::GetHref(nsString& aHref) const
>+ nsCOMPtr<nsIURI> uri;
>+ rv = ioService->NewURI(href, nullptr, nullptr, getter_AddRefs(uri));
>+ if (NS_FAILED(rv)) {
>+ aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
Why it throws DOM SyntaxError instead of ES TypeError?
| Assignee | ||
Comment 6•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=2219e15805e7
I'm going to change NS_ERROR_DOM_SYNTAX_ERR to NS_ERROR_DOM_TYPE_ERR before landing.
| Assignee | ||
Comment 7•12 years ago
|
||
Attachment #817648 -
Attachment is obsolete: true
| Assignee | ||
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
(In reply to Andrea Marchesini (:baku) from comment #6)
> https://tbpl.mozilla.org/?tree=Try&rev=2219e15805e7
>
> I'm going to change NS_ERROR_DOM_SYNTAX_ERR to before
> landing.
NS_ERROR_DOM_TYPE_ERR is not a bona fide ES TypeError. It is a DOMException for XPConnect bindings to simulate TypeError. You should use .ThrowTypeError method.
Note that you will have to manually ensure cleanup is performed to use .ThrowTypeError.
Comment 10•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Comment 11•12 years ago
|
||
Hey, NS_ERROR_DOM_TYPE_ERR (I confused it with NS_ERROR_TYPE_ERR) is one of XPathException. The landed code is completely bogus.
Why wasn't this change reviewed by a DOM peer?
Comment 13•12 years ago
|
||
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #12)
> Why wasn't this change reviewed by a DOM peer?
Ehsan? Could you explain?
Flags: needinfo?(ehsan)
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•