Change getInnerHTML() parameter to an options bag

Per the explainer [1] and associated spec PRs, getInnerHTML() should use
an options bag parameter, rather than just a boolean for the
includeShadowRoots flag. This CL implements that change.

[1] https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#serialization

Bug: 1042130
Change-Id: I678db433bc9555b6cf441d93f245cb1485c16e51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166138
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763475}
diff --git a/shadow-dom/declarative/getinnerhtml.tentative.html b/shadow-dom/declarative/getinnerhtml.tentative.html
index 0e6590b..25af077 100644
--- a/shadow-dom/declarative/getinnerhtml.tentative.html
+++ b/shadow-dom/declarative/getinnerhtml.tentative.html
@@ -24,15 +24,16 @@
       let correctHtml = `<${elementType}>${correctShadowHtml}</${elementType}>`;
       const shadowRoot = element.attachShadow({mode: mode, delegatesFocus: delegatesFocus});
       shadowRoot.appendChild(document.createElement('slot'));
-      assert_equals(wrapper.getInnerHTML(true),correctHtml);
+      assert_equals(wrapper.getInnerHTML({includeShadowRoots: true}),correctHtml);
+      assert_equals(wrapper.getInnerHTML(),correctHtml,'The default for includeShadowRoots should be true');
     } else {
-      // For non-shadow hosts, getInnerHTML(true) should also match .innerHTML
-      assert_equals(wrapper.getInnerHTML(true),wrapper.innerHTML);
+      // For non-shadow hosts, getInnerHTML() should also match .innerHTML
+      assert_equals(wrapper.getInnerHTML({includeShadowRoots: true}),wrapper.innerHTML);
+      assert_equals(wrapper.getInnerHTML(),wrapper.innerHTML);
     }
 
-    // Either way, make sure getInnerHTML() matches .innerHTML
-    assert_equals(wrapper.getInnerHTML(false),wrapper.innerHTML,'getInnerHTML() with includeShadowRoots false should return the same as .innerHTML');
-    assert_equals(wrapper.getInnerHTML(),wrapper.innerHTML,'getInnerHTML() with no arguments should return the same as .innerHTML');
+    // Either way, make sure getInnerHTML({includeShadowRoots: false}) matches .innerHTML
+    assert_equals(wrapper.getInnerHTML({includeShadowRoots: false}),wrapper.innerHTML,'getInnerHTML() with includeShadowRoots false should return the same as .innerHTML');
 
   }, `getInnerHTML() on <${elementType}>${allowsShadowDom ? `, with mode=${mode}, delegatesFocus=${delegatesFocus}.` : ''}`);
 }
@@ -40,8 +41,6 @@
 function runAllTests() {
   const allElements = HTML5_ELEMENT_NAMES;
   const safelisted = ATTACHSHADOW_SAFELISTED_ELEMENTS;
-  const minimumKnownElements = 107; // We should have at least this many elements in the lists from shadow-dom-utils.js.
-  assert_true(allElements.length >= minimumKnownElements,'All element types should be tested');
   for (let elementName of allElements) {
     const allowsShadowDom = safelisted.includes(elementName);
     if (allowsShadowDom) {
diff --git a/shadow-dom/declarative/script-access.tentative.html b/shadow-dom/declarative/script-access.tentative.html
index aff8640..250a036 100644
--- a/shadow-dom/declarative/script-access.tentative.html
+++ b/shadow-dom/declarative/script-access.tentative.html
@@ -20,13 +20,13 @@
             assert_in_array(shadowroot, ['open','closed'], 'Declarative template should have shadowroot attribute');
             assert_equals(n.content, null, 'Declarative template content should be null');
             assert_equals(n.innerHTML, "", 'Declarative template innerHTML should be empty');
-            assert_equals(n.getInnerHTML(true), "", 'Declarative template getInnerHTML() should be empty');
+            assert_equals(n.getInnerHTML({includeShadowRoots: true}), "", 'Declarative template getInnerHTML() should be empty');
 
             // Make sure removing the shadowroot attribute doesn't affect things.
             n.removeAttribute('shadowroot');
             assert_equals(n.content, null, 'Declarative template content should *still* be null');
             assert_equals(n.innerHTML, "", 'Declarative template innerHTML should *still* be empty');
-            assert_equals(n.getInnerHTML(true), "", 'Declarative template getInnerHTML() should *still* be empty');
+            assert_equals(n.getInnerHTML({includeShadowRoots: true}), "", 'Declarative template getInnerHTML() should *still* be empty');
             break;
           case 'noroot':
             // Make sure adding 'shadowroot' attribute doesn't trigger a shadow root,
@@ -34,7 +34,7 @@
             n.setAttribute('shadowroot','open');
             assert_not_equals(n.content, null, 'Regular template should have content, even after adding shadowroot attribute');
             assert_not_equals(n.innerHTML, "", 'Regular template should have innerHTML, even after adding shadowroot attribute');
-            assert_not_equals(n.getInnerHTML(true), "", 'Regular template should have getInnerHTML(), even after adding shadowroot attribute');
+            assert_not_equals(n.getInnerHTML({includeShadowRoots: true}), "", 'Regular template should have getInnerHTML(), even after adding shadowroot attribute');
             break;
           default:
             assert_unreached('Unrecognized template');