Bug 148852 - script.text should behave like script.textContent on setting
Summary: script.text should behave like script.textContent on setting
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-09-04 16:52 PDT by Ryosuke Niwa
Modified: 2016-08-27 10:47 PDT (History)
6 users (show)

See Also:


Attachments
Patch (3.26 KB, patch)
2016-08-27 09:21 PDT, Andreas Kling
cdumez: review+
cdumez: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (3.26 KB, patch)
2016-08-27 10:16 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-09-04 16:52:37 PDT
See https://html.spec.whatwg.org/multipage/scripting.html#dom-script-text

The setter implementation of HTMLScriptElement.prototype.text should be identical to that of textContent but it isn't.

This bug was found by the newly added test:
LayoutTests/http/tests/w3c/html/semantics/scripting-1/the-script-element/script-text.html
Comment 1 Andreas Kling 2016-08-27 09:21:00 PDT
Created attachment 287204 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2016-08-27 09:21:39 PDT
<rdar://problem/28044640>
Comment 3 Chris Dumez 2016-08-27 09:57:29 PDT
Comment on attachment 287204 [details]
Patch

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

r=me with comment.

> Source/WebCore/html/HTMLScriptElement.cpp:85
> +    setTextContent(value, IGNORE_EXCEPTION);

I believe this cannot actually throw. If this is the case, then we should use ASSERT_NOT_EXCEPTION, not IGNORE_EXCEPTION. If it can actually throw, then we should use [SetterRaisesException] on the text attribute and relay the exception to the caller.
Comment 4 Andreas Kling 2016-08-27 10:02:15 PDT
Comment on attachment 287204 [details]
Patch

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

>> Source/WebCore/html/HTMLScriptElement.cpp:85
>> +    setTextContent(value, IGNORE_EXCEPTION);
> 
> I believe this cannot actually throw. If this is the case, then we should use ASSERT_NOT_EXCEPTION, not IGNORE_EXCEPTION. If it can actually throw, then we should use [SetterRaisesException] on the text attribute and relay the exception to the caller.

Hmm. You are probably right about this. I suspect the same is also true for HTMLAnchorElement.text and HTMLTitleElement.text
Comment 5 Andreas Kling 2016-08-27 10:16:00 PDT
Created attachment 287205 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2016-08-27 10:47:00 PDT
Comment on attachment 287205 [details]
Patch for landing

Clearing flags on attachment: 287205

Committed r205079: <http://trac.webkit.org/changeset/205079>
Comment 7 WebKit Commit Bot 2016-08-27 10:47:05 PDT
All reviewed patches have been landed.  Closing bug.