WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
36802
setting document.title doesn't change document.title value
https://bugs.webkit.org/show_bug.cgi?id=36802
Summary
setting document.title doesn't change document.title value
Hajime Morrita
Reported
2010-03-29 20:41:41 PDT
When <title> element has 2 children, setting document.title fails. See attached for a concrete example.
Attachments
reproduce
(340 bytes, text/html)
2010-03-30 00:36 PDT
,
Hajime Morrita
no flags
Details
patch v0
(5.46 KB, patch)
2010-03-31 00:30 PDT
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
v1; fix style violation
(5.45 KB, patch)
2010-03-31 00:39 PDT
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
v2; fixed typo, did respect the change on Bug 25567
(5.41 KB, patch)
2010-04-01 04:00 PDT
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
v3; fix changelog wording a litle
(5.41 KB, patch)
2010-04-01 04:08 PDT
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2010-03-29 23:34:25 PDT
There is no attachment in this bug.
Hajime Morrita
Comment 2
2010-03-30 00:36:10 PDT
Created
attachment 52009
[details]
reproduce
>There is no attachment in this bug.
Oops. I've failed to attach it. Sorry for that.
Hajime Morrita
Comment 3
2010-03-31 00:30:28 PDT
Created
attachment 52135
[details]
patch v0
WebKit Review Bot
Comment 4
2010-03-31 00:31:54 PDT
Attachment 52135
[details]
did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebCore/html/HTMLTitleElement.cpp:84: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Hajime Morrita
Comment 5
2010-03-31 00:39:16 PDT
Created
attachment 52137
[details]
v1; fix style violation
Hajime Morrita
Comment 6
2010-03-31 00:43:11 PDT
This problems caused by Document.setTitle() which is called during removeChildren(). So another possible approach is defer event propagation during HTMLTitleElement::setText(). But it seems too complicated because it will need a variant of both removeChidren() and addChild() that support deffering event dispatch, and we don't have such one.
Darin Adler
Comment 7
2010-03-31 13:00:12 PDT
Comment on
attachment 52137
[details]
v1; fix style violation
> + When HTMLTitleElement::setText() is called reentrant manner by > + Document::seTitle(), the argument of setText() changes implicitly.
Typo: "Document:seTitle".
> +description("This test checks to see if setting documen.title works even if the title element has multiple children.");
Typo here: "documen"
> + // We make a copy here because value.m_impl will be changed implicitly during removeChildren(), > + // which causes HTMLTitleElement::childrenChanged(), which ends up Document::setTitle(). > + String valueCopy(value);
The comment is a little confusing because strings are immutable. The real issue is that value is a reference to a string from the DOM tree. But given the special case this patch added above for empty values and no children, I don't think this second code change actually matters. Could you test without this second change? I believe only the isEmpty change is needed. I'm going to say review+, though. This seems slightly flawed, but OK. The test is the best part!
Darin Adler
Comment 8
2010-03-31 13:01:56 PDT
(In reply to
comment #7
)
> But given the special case this patch added above for empty values and no > children, I don't think this second code change actually matters. Could you > test without this second change? I believe only the isEmpty change is needed. > > I'm going to say review+, though. This seems slightly flawed, but OK. The test > is the best part!
Further, I think the fix for
bug 25567
takes care of this in another way. I suggest we make only the minimum code changes needed to fix the problem.
Hajime Morrita
Comment 9
2010-04-01 04:00:17 PDT
Created
attachment 52282
[details]
v2; fixed typo, did respect the change on
Bug 25567
Hajime Morrita
Comment 10
2010-04-01 04:08:41 PDT
Created
attachment 52283
[details]
v3; fix changelog wording a litle
Hajime Morrita
Comment 11
2010-04-01 04:09:41 PDT
Darin, thank you reviewing! I updated the patch. (In reply to
comment #7
)
> Typo: "Document:seTitle". > (snip) > Typo here: "documen"
Fixed.
> > > + // We make a copy here because value.m_impl will be changed implicitly during removeChildren(), > > + // which causes HTMLTitleElement::childrenChanged(), which ends up Document::setTitle(). > > + String valueCopy(value); > > The comment is a little confusing because strings are immutable. The real issue > is that value is a reference to a string from the DOM tree.
Agreed. And tried to clarify the comment.
> > But given the special case this patch added above for empty values and no > children, I don't think this second code change actually matters. Could you > test without this second change? I believe only the isEmpty change is needed.
This was required. But the fix on
Bug 25567
made this special case no longer usefull. Thank you pointing it out at #8.
Darin Adler
Comment 12
2010-04-01 16:39:05 PDT
Comment on
attachment 52283
[details]
v3; fix changelog wording a litle
> + // We make a copy here because entity of "value" argument can be Document::m_title, > + // which goes empty during removeChildren() invocation below, > + // which causes HTMLTitleElement::childrenChanged(), which ends up Document::setTitle().
"ends up Document::setTitle" should be "ends up calling Document::setTitle". r=me
WebKit Commit Bot
Comment 13
2010-04-01 23:34:37 PDT
Comment on
attachment 52283
[details]
v3; fix changelog wording a litle Clearing flags on attachment: 52283 Committed
r56974
: <
http://trac.webkit.org/changeset/56974
>
WebKit Commit Bot
Comment 14
2010-04-01 23:34:44 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