Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Issue 2532393003: Remove the wrong optimization in replacing a text node with innerHTML (Closed)

Created:
4 years ago by hayato
Modified:
4 years ago
Reviewers:
tkent, kochi
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove the wrong optimization in replacing a text node with innerHTML Replacing a single text node with innerHTML optimizes its behavior; it does not use a normal DOM mutation function. See `replaceChildrenWithFragment()` in Serialization.cpp for details. This optimization is wrong: <div>original</div> var originalText = div.firstChild; div.innerHTML = 'updated'; console.log(originalText.data); // It should show "original", but shows "updated". In addition to this wrong behavior, this optimization also: - Prevents a slotchange event from being fired because it skips the check. - Prevents a mutation observer from being notified. BUG=658605 Committed: https://crrev.com/946f30141fad7e002a44d3545a7d9f45e3cdcbf3 Cr-Commit-Position: refs/heads/master@{#435908}

Patch Set 1 #

Total comments: 7

Patch Set 2 : removed #

Patch Set 3 : remove an unnecessary expected.txt because the test becomes to pass. #

Patch Set 4 : rebased #

Patch Set 5 : use NeedsRebaseline #

Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -84 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/dom/adopt-node-crash.html View 1 2 3 1 chunk +0 lines, -24 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/dom/adopt-node-crash-expected.txt View 1 2 3 1 chunk +0 lines, -3 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/events/crash-on-mutate-during-drop.html View 1 2 3 1 chunk +0 lines, -41 lines 0 comments Download
D third_party/WebKit/LayoutTests/fast/events/crash-on-mutate-during-drop-expected.txt View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/stylenonce-basic-blocked-error-event-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/stylenonce-svg-style-basic-blocked-error-event-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
D third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/MutationObserver-inner-outer-expected.txt View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/shadow-dom/slotchange.html View 1 1 chunk +21 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/serializers/Serialization.cpp View 1 1 chunk +0 lines, -7 lines 0 comments Download

Messages

Total messages: 58 (39 generated)
hayato
PTAL
4 years ago (2016-11-30 03:31:34 UTC) #5
tkent
https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp File third_party/WebKit/Source/core/editing/serializers/Serialization.cpp (right): https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp#newcode717 third_party/WebKit/Source/core/editing/serializers/Serialization.cpp:717: if (containerNode->hasOneTextChild() && fragment->hasOneTextChild()) { We should remove this ...
4 years ago (2016-11-30 03:50:25 UTC) #6
kochi
https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html File third_party/WebKit/LayoutTests/shadow-dom/slotchange.html (right): https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html#newcode314 third_party/WebKit/LayoutTests/shadow-dom/slotchange.html:314: <div id="host1"> Not critial, but all these subtrees have ...
4 years ago (2016-11-30 04:20:37 UTC) #7
hayato
removed
4 years ago (2016-11-30 05:11:08 UTC) #10
hayato
Thanks you for the reviews. https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html File third_party/WebKit/LayoutTests/shadow-dom/slotchange.html (right): https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html#newcode319 third_party/WebKit/LayoutTests/shadow-dom/slotchange.html:319: </div> Done. https://codereview.chromium.org/2532393003/diff/1/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html#newcode323 third_party/WebKit/LayoutTests/shadow-dom/slotchange.html:323: ...
4 years ago (2016-11-30 05:22:56 UTC) #16
tkent
PS2 fixes imported/wpt/dom/nodes/MutationObserver-inner-outer.html. It's a good sign.
4 years ago (2016-11-30 06:04:01 UTC) #17
kochi
lgtm
4 years ago (2016-11-30 07:02:49 UTC) #22
hayato
remove an unnecessary expected.txt because the test becomes to pass.
4 years ago (2016-11-30 07:32:51 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2532393003/40001
4 years ago (2016-11-30 09:27:38 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/340968)
4 years ago (2016-11-30 11:06:34 UTC) #32
hayato
It looks the patch would cause a regression on some tests. Let me take a ...
4 years ago (2016-12-01 06:32:26 UTC) #37
hayato
Some of failing tests are mutating a text node in a mutation observer handler, and ...
4 years ago (2016-12-02 05:05:36 UTC) #38
tkent
On 2016/12/02 at 05:05:36, hayato wrote: > Some of failing tests are mutating a text ...
4 years ago (2016-12-02 05:08:41 UTC) #39
hayato
rebased
4 years ago (2016-12-02 06:03:20 UTC) #40
hayato
use NeedsRebaseline
4 years ago (2016-12-02 08:02:36 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2532393003/80001
4 years ago (2016-12-02 08:51:51 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2532393003/80001
4 years ago (2016-12-02 08:53:46 UTC) #54
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years ago (2016-12-02 10:44:00 UTC) #56
commit-bot: I haz the power
4 years ago (2016-12-02 10:46:37 UTC) #58
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/946f30141fad7e002a44d3545a7d9f45e3cdcbf3
Cr-Commit-Position: refs/heads/master@{#435908}

Powered by Google App Engine
This is Rietveld 408576698