Bug 128067 - Adopt URLUtils interface and template in HTMLAnchorElement and HTMLAreaElement
Summary: Adopt URLUtils interface and template in HTMLAnchorElement and HTMLAreaElement
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Maciej Stachowiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-01 23:38 PST by Maciej Stachowiak
Modified: 2017-11-17 23:22 PST (History)
12 users (show)

See Also:


Attachments
Patch (11.91 KB, patch)
2014-02-01 23:39 PST, Maciej Stachowiak
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 (468.17 KB, application/zip)
2014-02-02 00:33 PST, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion (503.37 KB, application/zip)
2014-02-02 01:00 PST, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion (503.33 KB, application/zip)
2014-02-02 01:58 PST, Build Bot
no flags Details
Patch (23.43 KB, patch)
2014-02-02 12:00 PST, Maciej Stachowiak
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 2014-02-01 23:38:15 PST
Adopt URLUtils interface and template in HTMLAnchorElement and HTMLAreaElement
Comment 1 Maciej Stachowiak 2014-02-01 23:39:17 PST
Created attachment 222913 [details]
Patch
Comment 2 WebKit Commit Bot 2014-02-01 23:39:53 PST
Attachment 222913 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Maciej Stachowiak 2014-02-01 23:43:00 PST
Comment on attachment 222913 [details]
Patch

Unflagging; posted for EWS purposes only.
Comment 4 Build Bot 2014-02-02 00:33:50 PST
Comment on attachment 222913 [details]
Patch

Attachment 222913 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5656720835608576

New failing tests:
fast/dom/element-attribute-js-null.html
js/dom/dom-static-property-for-in-iteration.html
Comment 5 Build Bot 2014-02-02 00:33:52 PST
Created attachment 222916 [details]
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-13  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 6 Build Bot 2014-02-02 01:00:14 PST
Comment on attachment 222913 [details]
Patch

Attachment 222913 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5938195812319232

New failing tests:
fast/dom/element-attribute-js-null.html
js/dom/dom-static-property-for-in-iteration.html
Comment 7 Build Bot 2014-02-02 01:00:18 PST
Created attachment 222917 [details]
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-02  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 8 Build Bot 2014-02-02 01:58:25 PST
Comment on attachment 222913 [details]
Patch

Attachment 222913 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6223781072732160

New failing tests:
fast/dom/element-attribute-js-null.html
js/dom/dom-static-property-for-in-iteration.html
Comment 9 Build Bot 2014-02-02 01:58:27 PST
Created attachment 222920 [details]
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-05  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 10 Maciej Stachowiak 2014-02-02 12:00:47 PST
Created attachment 222929 [details]
Patch
Comment 11 mitz 2014-02-02 12:33:13 PST
Comment on attachment 222929 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=222929&action=review

Looks OK, but still doesn’t build on Windows.

> Source/WebCore/html/HTMLAnchorElement.h:66
>      void setHref(const AtomicString&);
> +    void setHref(const AtomicString& value, ExceptionCode&) { setHref(value); }

Is it valid to call this in a manner that throws an exception? If not, shouldn’t we just use the ASSERT_NO_EXCEPTION mechanism?

> LayoutTests/js/dom/dom-static-property-for-in-iteration.html:9
> +    <div id="console"></div>

Did you intend to make this change? It seems like this is responsible for many of the changes to the result above.
Comment 12 Antti Koivisto 2014-02-02 13:42:10 PST
Comment on attachment 222929 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=222929&action=review

Looks good except for the strange test change.

>> Source/WebCore/html/HTMLAnchorElement.h:66
>> +    void setHref(const AtomicString& value, ExceptionCode&) { setHref(value); }
> 
> Is it valid to call this in a manner that throws an exception? If not, shouldn’t we just use the ASSERT_NO_EXCEPTION mechanism?

If argument-free version is for internal use only and not part of the DOM then it is much better to keep it separate rather than uglify our code with ASSERT_NO_EXCEPTION.
Comment 13 Darin Adler 2014-02-02 16:14:45 PST
Comment on attachment 222929 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=222929&action=review

>>> Source/WebCore/html/HTMLAnchorElement.h:66
>>> +    void setHref(const AtomicString& value, ExceptionCode&) { setHref(value); }
>> 
>> Is it valid to call this in a manner that throws an exception? If not, shouldn’t we just use the ASSERT_NO_EXCEPTION mechanism?
> 
> If argument-free version is for internal use only and not part of the DOM then it is much better to keep it separate rather than uglify our code with ASSERT_NO_EXCEPTION.

Normally, I would say that I think the right fix here is to change the IDL file, since setting href can’t raise an exception.

But HTMLAnchorElement’s IDL file doesn’t create any calls to setHref, because href is a “reflect” attribute, so it calls setURLAttribute directly. Thus I don’t understand why this is needed at all? Where is the call site?
Comment 14 Maciej Stachowiak 2014-02-02 20:18:55 PST
(In reply to comment #11)
> (From update of attachment 222929 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=222929&action=review
> 
> Looks OK, but still doesn’t build on Windows.
> 
> > Source/WebCore/html/HTMLAnchorElement.h:66
> >      void setHref(const AtomicString&);
> > +    void setHref(const AtomicString& value, ExceptionCode&) { setHref(value); }
> 
> Is it valid to call this in a manner that throws an exception? If not, shouldn’t we just use the ASSERT_NO_EXCEPTION mechanism?

Not sure what you mean. The exception code is passed in, not out. This method will never throw an exception itself. The exception argument is only because the href setter is declared as possibly throwing in URLUtils.idl, but the HTMLAnchorElement version will never actually throw.

> 
> > LayoutTests/js/dom/dom-static-property-for-in-iteration.html:9
> > +    <div id="console"></div>
> 
> Did you intend to make this change? It seems like this is responsible for many of the changes to the result above.

Yes. I wanted to move the link above the output, so that its position would not change solely due to a new property being added (since its hard to tell if the new offset is correct).
Comment 15 Maciej Stachowiak 2014-02-02 20:20:45 PST
(In reply to comment #13)
> (From update of attachment 222929 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=222929&action=review
> 
> >>> Source/WebCore/html/HTMLAnchorElement.h:66
> >>> +    void setHref(const AtomicString& value, ExceptionCode&) { setHref(value); }
> >> 
> >> Is it valid to call this in a manner that throws an exception? If not, shouldn’t we just use the ASSERT_NO_EXCEPTION mechanism?
> > 
> > If argument-free version is for internal use only and not part of the DOM then it is much better to keep it separate rather than uglify our code with ASSERT_NO_EXCEPTION.
> 
> Normally, I would say that I think the right fix here is to change the IDL file, since setting href can’t raise an exception.
> 
> But HTMLAnchorElement’s IDL file doesn’t create any calls to setHref, because href is a “reflect” attribute, so it calls setURLAttribute directly. Thus I don’t understand why this is needed at all? Where is the call site?

HTMLAnchorElement now no longer defines href itself; instead it is defined in URLUtils.idl. Officially per the URL and HTML specs, HTMLAnchorElement is now supposed to get its href by implementing URLUtils rather than directly. This also means that it can't be a "reflect" attribute now, because URLUtil is also used by interfaces that are not elements. Specifically by DOMURL, which can throw from the href setter, which is why it has the possibility of exceptions which don't actually apply here.
Comment 16 Maciej Stachowiak 2014-02-03 03:08:54 PST
Committed r163299: <http://trac.webkit.org/changeset/163299>
Comment 17 Csaba Osztrogonác 2014-02-03 04:09:31 PST
(In reply to comment #16)
> Committed r163299: <http://trac.webkit.org/changeset/163299>

FYI: It broke the Apple Windows build, as the EWS noticed it before landing.
Comment 18 Csaba Osztrogonác 2014-02-03 05:59:06 PST
And it broke the build on the 32 bit Apple Mountain Lion bot too:
http://build.webkit.org/builders/Apple%20MountainLion%20Release%20%2832-bit%20Build%29/builds/8846
Comment 19 Jessie Berlin 2014-02-03 09:02:34 PST
I am going to roll out this patch, since it broke a number of builds. Output for the ML 32-bit release build:

/Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:248:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
/Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:267:30: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
/Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:287:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
/Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:248:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
/Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:267:30: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
/Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:287:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
Comment 20 Jessie Berlin 2014-02-03 09:25:08 PST
(In reply to comment #19)
> I am going to roll out this patch, since it broke a number of builds. Output for the ML 32-bit release build:
> 
> /Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:248:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
> /Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:267:30: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
> /Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:287:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
> /Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:248:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
> /Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:267:30: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')
> /Volumes/Data/slave/mountainlion-32bit-release/build/Source/WebCore/html/URLUtils.h:287:14: error: use of overloaded operator '[]' is ambiguous (with operand types 'const WTF::String' and 'int')

Rollout done in http://trac.webkit.org/changeset/163309
Comment 21 Jessie Berlin 2014-02-03 09:25:32 PST
Re-opening due to the rollout.
Comment 22 Maciej Stachowiak 2017-11-17 23:22:32 PST
This has subsequently been done in a different, likely more modern way (as HTMLHyperlinkElementUtils).