Commit e99e5f2d authored by Jonathan Lee's avatar Jonathan Lee Committed by moz-wptsync-bot
Browse files

Bug 1869441 [wpt PR 43615] - Revert soft navigation CLs which are causing crashes, a=testonly

Automatic update from web-platform-tests
Revert soft navigation CLs which are causing crashes (#43615)

Revert soft navigation CLs which are causing crashes

This reverts a series of 7 CLs which were causing crashes on both
Canary and Beta channels.

We will follow-up re-enabling these behind a flag, with additional
tests.

Reverts:
* commit bc3a536a4fc930ff5161c7795758e72893b6afca.
    "Reland "[soft-navigations] move startTime to processing end""

* commit 6e358318d16c22292d0e57ed7542fe3761c42a72.
    "[soft navigations] Ignore non-attributed LCP before softnav detection"

* commit 81fd9fb434f38f1411baae1e30835c21011974e8.
    "[soft-navigations] Fix crash when user interaction precedes softnav"

* commit 596e49410759e65ee39d5ffb22f8e4789b5d836b.
    "Create ScriptState::Scope in SetCurrentTimeAsStartTime()"

* commit 6039f57d5e4bf6817f6ca4e75ea65e864fcfc2cf.
    "Move SoftNavigation end of event emission to a handle based on isolate"

* commit afec46c737c5547302fa35a3944624df44fad755.
    "Fix crash by adding v8::HandleScope in SameDocumentCommit"

* commit ad7d9d258f8255f2000cb3cf7a081d1bfe3c3b22.
    "Add tests to exercise sync soft navigations paths"

Bug: 1507470, 1508696, 1507981, 1507750, 1505994, 1505059
Change-Id: I2a8283c6958f1cf7724a246ae8026ad6d2300864
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5111999


Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Auto-Submit: Ian Clelland <iclelland@chromium.org>
Reviewed-by: default avatarAnnie Sullivan <sullivan@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1235919}
--

wpt-commits: a50aec6c90d6ce28629fa4eb5cbeba0d1d65c53b
wpt-pr: 43615
parent d0e16287
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/soft-navigation-helper.js"></script>
</head>
<body>
  <main id=main>
  <a id=link>Click me!</a>
  </main>
  <script>
    const link = document.getElementById("link");
    // Adding a noop event that the "click" would bubble to.
    document.getElementById("main").addEventListener("click", () => {});

    testSoftNavigation({
      addContent: () => {
        addTextParagraphToMain("Lorem Ipsum");
      },
      link: link,
      test: "Ensure event bubbling works well with soft navigations."});
  </script>
</body>
</html>
+0 −60
Original line number Diff line number Diff line
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/soft-navigation-helper.js"></script>
</head>
<body>
  <main id=main>
    <div>
      <a id=link><img src="/images/lcp-256x256.png" id="img"></a>
    </div>
  </main>
  <script>
    const link = document.getElementById("link");
    let first_lcp_painted;
    let second_lcp_painted;
    (async () => {
      await new Promise(r => { first_lcp_painted = r; });
      addImageToMain("lcp-133x106.png", "no_lcp");
      (new PerformanceObserver(second_lcp_painted)).observe({type: "element"});
    })();
    testSoftNavigation({
      pushState: null,
      clicks: 2,
      addContent: async () => {
        // Add an LCP element.
        await new Promise(resolve => {
          addImageToMain("lcp-100x50.png", "first_lcp" + counter);
          (new PerformanceObserver(resolve)).observe({type: "element"});
        });
        if(counter) {
          first_lcp_painted();
          // Wait for the unrelated LCP to be painted.
          await new Promise(r => { second_lcp_painted = r; });
        }
        const url = URL + "?" + counter;
        history.pushState({}, '', url);
      },
      link: link,
      validate: async () => {
        const lcps = await getLcpEntries();
        const ref_counter = counter-1;
        assert_equals(lcps.length, 2 + ref_counter, "Got 2 LCP entries");
        assert_equals(lcps[lcps.length - 1].id, "first_lcp" + ref_counter,
                      "Got the first LCP");
      },
      test: "Second soft navigation image LCP discovered between user " +
            "interaction and soft navigation detection are properly " +
            "reported, while unrelated LCPs are ignored during that time. " +
            "As a side effect, we also test element timing."});
  </script>
</body>
</html>


+0 −71
Original line number Diff line number Diff line
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/soft-navigation-helper.js"></script>
</head>
<body>
  <main id=main>
    <div>
      <a id=link><img src="/images/lcp-256x256.png" id="img"></a>
      <a id=not_nav><img src="/images/lcp-16x16.png"></a>
    </div>
  </main>
  <script>
    const link = document.getElementById("link");
    let first_lcp_painted;
    let second_lcp_painted;
    // Trigger a user interaction that doesn't result in a soft navigation, but
    // does paint.
    (async () => {
      const not_nav = document.getElementById("not_nav");
      let non_soft_nav_click;
      const non_soft_nav_click_promise =
        new Promise(r => { non_soft_nav_click = r; });
      not_nav.addEventListener("click", () => {
        addImageToMain("lcp-1x1.png", "not_soft_nav_image");
        (new PerformanceObserver(non_soft_nav_click)).observe({type: "element"});
      });
      if (test_driver) {
        test_driver.click(not_nav);
      }
      await non_soft_nav_click_promise;
    })();
    (async () => {
      await new Promise(r => { first_lcp_painted = r; });
      addImageToMain("lcp-133x106.png", "no_lcp");
      (new PerformanceObserver(second_lcp_painted)).observe({type: "element"});
    })();
    testSoftNavigation({
      pushState: null,
      addContent: async () => {
        // Add an LCP element.
        await new Promise(resolve => {
          addImageToMain("lcp-100x50.png", "first_lcp");
          (new PerformanceObserver(resolve)).observe({type: "element"});
        });
        first_lcp_painted();
        // Wait for the unrelated LCP to be painted.
        await new Promise(r => { second_lcp_painted = r; });
        const url = URL + "?" + counter;
        history.pushState({}, '', url);
      },
      link: link,
      validate: async () => {
        const lcps = await getLcpEntries();
        assert_equals(lcps.length, 2, "Got 2 LCP entries");
        assert_equals(lcps[lcps.length - 1].id, "first_lcp", "Got the first LCP");
      },
      test: "Image LCP discovered between user interaction and soft " +
            "navigation detection are properly reported, while unrelated " +
            "LCPs are ignored during that time. As a side effect, we also " +
            "test element timing."});
  </script>
</body>
</html>

+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
    });
    testSoftNavigation({
      eventPrepWork: url => {
        timestamps[counter]["eventStart"] = performance.now();
        addTextToDivOnMain();
        history.pushState({}, '', 'foobar1.html');
        // Here we're bypassing the regular test's event logic, as this test is
+1 −1
Original line number Diff line number Diff line
@@ -16,11 +16,11 @@
  <script>
    const link = document.getElementById("link");
    testNavigationApi("Test soft navigation when navigate event intecepts with { commit: 'after-transition' }", e => {
        timestamps[counter]["eventStart"] = performance.now();
        e.intercept({commit: "after-transition", handler: async () => {
          await addImageToMain();
          e.commit();
        }});
        timestamps[counter]["eventEnd"] = performance.now();
      }, link);
  </script>
</body>
Loading