Remove isOrphan check in ShadowRoot::setInnerHTML
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Sep 2018 21:48:55 +0000 (21:48 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Sep 2018 21:48:55 +0000 (21:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189449

Reviewed by Darin Adler.

Removed isOrphan() check in ShadowRoot::setInnerHTML needed for webkit.org/b/88834.

The only reason this check was kept in the code was because the fix for V8 couldn't be landed
due to a perf regression but V8 binding isn't even a thing in WebKit anymore.

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::setInnerHTML):
* dom/ShadowRoot.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235864 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html
Source/WebCore/ChangeLog
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/ShadowRoot.h

index 37d07a7..0f6cb60 100644 (file)
@@ -64,7 +64,7 @@ function testComposedEvent(mode) {
 
         var expectedPath = ['A1a', 'A1-SR', 'A1', 'A-SR', 'A'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : ['A1', 'A-SR', 'A'],
@@ -92,7 +92,7 @@ function testNonComposedEvent(mode) {
 
         var expectedPath = ['A1a', 'A1-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
     }, 'The event must not propagate out of ' + mode + ' mode shadow boundaries when the composed flag is unset');
@@ -118,7 +118,7 @@ function testNonComposedEventWithRelatedTarget(mode) {
 
         var expectedPath = ['A1a', 'A1-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.relatedTargets, ['A2-S', 'A2-S']);
@@ -146,7 +146,7 @@ function testScopedEventWithUnscopedRelatedTargetThroughSlot(mode) {
         var expectedPath = ['B1a', 'B1c-S', 'B1-SR', 'B1', 'B-SR'];
         var pathExposedToB1a = ['B1a', 'B1', 'B-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.pathAtTargets[2], expectedPath);
@@ -177,7 +177,7 @@ function testComposedEventWithRelatedTarget(mode) {
         var expectedPath = ['A1a', 'A1-SR', 'A1', 'A-SR'];
         var pathExposedToA1 = ['A1', 'A-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : pathExposedToA1);
@@ -212,7 +212,7 @@ function testComposedEventThroughSlot(mode) {
         var pathExposedToA1 =       [                                       'B', 'A2-S', 'A-SR', 'A'];
 
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[1], mode == 'open' ? expectedPath : pathExposedToB1cS);
         assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : pathExposedToB1cS);
index 73ca8f5..e7c4c07 100644 (file)
@@ -1,3 +1,19 @@
+2018-09-08  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove isOrphan check in ShadowRoot::setInnerHTML
+        https://bugs.webkit.org/show_bug.cgi?id=189449
+
+        Reviewed by Darin Adler.
+
+        Removed isOrphan() check in ShadowRoot::setInnerHTML needed for webkit.org/b/88834.
+
+        The only reason this check was kept in the code was because the fix for V8 couldn't be landed
+        due to a perf regression but V8 binding isn't even a thing in WebKit anymore.
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::setInnerHTML):
+        * dom/ShadowRoot.h:
+
 2018-09-10  Simon Fraser  <simon.fraser@apple.com>
 
         Many textarea tests leak documents because Document::removeFocusNavigationNodeOfSubtree() can trigger a Document retain cycle
index bedaadc..ff49cf5 100644 (file)
@@ -134,8 +134,6 @@ String ShadowRoot::innerHTML() const
 
 ExceptionOr<void> ShadowRoot::setInnerHTML(const String& markup)
 {
-    if (isOrphan())
-        return Exception { InvalidAccessError };
     auto fragment = createFragmentForInnerOuterHTML(*host(), markup, AllowScriptingContent);
     if (fragment.hasException())
         return fragment.releaseException();
index 2bfc886..6b9cc9f 100644 (file)
@@ -95,9 +95,6 @@ protected:
 
     ShadowRoot(Document&, std::unique_ptr<SlotAssignment>&&);
 
-    // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=88834
-    bool isOrphan() const { return !m_host; }
-
 private:
     bool childTypeAllowed(NodeType) const override;