Fix Sandbox WPT using a non-existing file

Another file that was using ./common/blank.html instead of an existing
file. I also propose a fix for firefox behavior where it might not throw
if the origin is checked synchronously, this by adding a timeout and
trying again.

Change-Id: I2ce8277d09d03b4be575315b0828a4a279dd7337
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3720219
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Pâris Meuleman <pmeuleman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1021191}
diff --git a/html/semantics/embedded-content/the-iframe-element/sandbox-inherit-to-blank-document-unsandboxed-frame.html b/html/semantics/embedded-content/the-iframe-element/sandbox-inherit-to-blank-document-unsandboxed-frame.html
index 7040d07..0f35f28 100644
--- a/html/semantics/embedded-content/the-iframe-element/sandbox-inherit-to-blank-document-unsandboxed-frame.html
+++ b/html/semantics/embedded-content/the-iframe-element/sandbox-inherit-to-blank-document-unsandboxed-frame.html
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
 <html>
 <head>
   <script src="/resources/testharness.js"></script>
@@ -26,6 +27,12 @@
     assert_false(msg.data.access_first_navigation_to_about_blank_throws,
       "Failed to access navigation to about:blank, it is probably sandboxed"
     );
+    assert_false(msg.data.access_after_delay_initial_navigation_to_about_blank_throws,
+      "Failed to access navigation to about:blank, it is probably sandboxed"
+    );
+    assert_false(msg.data.access_after_delay_first_navigation_to_about_blank_throws,
+      "Failed to access navigation to about:blank, it is probably sandboxed"
+    );
   }, "Popup do not inherit sandbox, because of " +
      "'allow-popups-to-escape-sandbox'. The document isn't sandboxed.")
 
@@ -36,8 +43,10 @@
   <script>
     let access_initial_navigation_to_about_blank_throws = false;
     let access_first_navigation_to_about_blank_throws = false;
+    let access_after_delay_initial_navigation_to_about_blank_throws = false;
+    let access_after_delay_first_navigation_to_about_blank_throws = false;
     const initial_about_blank_window =
-      window.open('common/blank.html?pipe=status(204)');
+      window.open('/common/blank.html?pipe=status(204)');
     try {
       initial_about_blank_window.origin;
     } catch(e) {
@@ -49,12 +58,28 @@
     } catch(e) {
       access_first_navigation_to_about_blank_throws = true;
     }
-    top.postMessage({
-      'access_initial_navigation_to_about_blank_throws':
-        access_initial_navigation_to_about_blank_throws,
-      'access_first_navigation_to_about_blank_throws':
-        access_first_navigation_to_about_blank_throws
-    }, '*');
+    setTimeout(() => {
+      try {
+        initial_about_blank_window.origin;
+      } catch(e) {
+        access_after_delay_initial_navigation_to_about_blank_throws = true;
+      }
+      try {
+        renavigated_about_blank_window.origin;
+      } catch(e) {
+        access_after_delay_first_navigation_to_about_blank_throws = true;
+      }
+      top.postMessage({
+        'access_initial_navigation_to_about_blank_throws':
+          access_initial_navigation_to_about_blank_throws,
+        'access_first_navigation_to_about_blank_throws':
+          access_first_navigation_to_about_blank_throws,
+        'access_after_delay_initial_navigation_to_about_blank_throws':
+          access_after_delay_initial_navigation_to_about_blank_throws,
+        'access_after_delay_first_navigation_to_about_blank_throws':
+          access_after_delay_first_navigation_to_about_blank_throws
+      }, '*');
+    }, 500);
   </script>"
 >
 </iframe>