WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
159490
Align Document.body setter with the HTML specification
https://bugs.webkit.org/show_bug.cgi?id=159490
Summary
Align Document.body setter with the HTML specification
Chris Dumez
Reported
2016-07-06 14:08:03 PDT
Document.body setter should be accept a frameset element as input: -
https://html.spec.whatwg.org/multipage/dom.html#dom-document-body
We currently throw an exception when given a frameset element. Both Firefox and Chrome match the HTML specification.
Attachments
Patch
(16.17 KB, patch)
2016-07-06 15:10 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(8.42 KB, patch)
2016-07-06 15:18 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(9.82 KB, patch)
2016-07-06 19:00 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2016-07-06 15:10:21 PDT
Created
attachment 282954
[details]
Patch
Chris Dumez
Comment 2
2016-07-06 15:18:00 PDT
Created
attachment 282955
[details]
Patch
Alex Christensen
Comment 3
2016-07-06 17:10:35 PDT
Comment on
attachment 282955
[details]
Patch It seems like you should make newBody a Ref or keep the null check.
Chris Dumez
Comment 4
2016-07-06 18:31:13 PDT
(In reply to
comment #3
)
> Comment on
attachment 282955
[details]
> Patch > > It seems like you should make newBody a Ref or keep the null check.
Why? if (!is<HTMLBodyElement>(newBody.get()) && !is<HTMLFrameSetElement>(newBody.get())) Will be true if newBody is null and therefore we will throw a HIERARCHY_REQUEST_ERR as expected. We cannot easily take a Ref<> because this function is used by the bindings and the type is nullable in the IDL. If we updated the type in the bindings to be non-nullable then we would no longer match the spec and we would throw a TypeError instead of a HIERARCHY_REQUEST_ERR.
Chris Dumez
Comment 5
2016-07-06 19:00:22 PDT
Created
attachment 282981
[details]
Patch
Chris Dumez
Comment 6
2016-07-06 19:01:09 PDT
(In reply to
comment #4
)
> (In reply to
comment #3
) > > Comment on
attachment 282955
[details]
> > Patch > > > > It seems like you should make newBody a Ref or keep the null check. > > Why? > > if (!is<HTMLBodyElement>(newBody.get()) && > !is<HTMLFrameSetElement>(newBody.get())) > Will be true if newBody is null and therefore we will throw a > HIERARCHY_REQUEST_ERR as expected. > > We cannot easily take a Ref<> because this function is used by the bindings > and the type is nullable in the IDL. If we updated the type in the bindings > to be non-nullable then we would no longer match the spec and we would throw > a TypeError instead of a HIERARCHY_REQUEST_ERR.
I added a test case to cover "document.body = null" to confirm that it still throws a HIERARCHY_REQUEST_ERR.
Alex Christensen
Comment 7
2016-07-06 20:54:06 PDT
Comment on
attachment 282981
[details]
Patch Sure enough. I should be more familiar with is<>. r=me That spec is very specific, and now our code reads like the spec.
WebKit Commit Bot
Comment 8
2016-07-06 21:15:05 PDT
Comment on
attachment 282981
[details]
Patch Clearing flags on attachment: 282981 Committed
r202893
: <
http://trac.webkit.org/changeset/202893
>
WebKit Commit Bot
Comment 9
2016-07-06 21:15:10 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug