static/frontend: fix close button on modal dialog

I was able to reproduce the issue by simulating a slowdown
on the dialog polyfill request. The request is small enough
and has a long cache life so any page load performance
decrease should be imperceptible and only affect first
time pkgsite visitors.

Fixes golang/go#50895.

Change-Id: Id8b8480ae8944528c267a5fedbe12c8fec785758
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/392954
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/middleware/secureheaders.go b/internal/middleware/secureheaders.go
index bdd38fa..37a71dc 100644
--- a/internal/middleware/secureheaders.go
+++ b/internal/middleware/secureheaders.go
@@ -15,7 +15,7 @@
 	"'sha256-DVdvl49HC0iGx/YKQq/kVNATnEdzGfExbJVTHqT95l8='",
 	// From static/frontend/frontend.tmpl
 	"'sha256-CoGrkqEM1Kjjf5b1bpcnDLl8ZZLAsVX+BoAzZ5+AOmc='",
-	"'sha256-MkavW4m/pckt7I/EGQvNFWb6xknju8KI19Sf6ZEFtkY='",
+	"'sha256-QqhlxKosyquihHG/Jahbski3BB1pDss2/CDgLzKKbmE='",
 	"'sha256-karKh1IrXOF1g+uoSxK+k9BuciCwYY/ytGuQVUiRzcM='",
 	"'sha256-mxm3e8M0u3nPPBmLIBgGuMvGUIL5LGv+HzV3bLAIBgw='",
 	// From static/frontend/search/search.tmpl
diff --git a/static/frontend/frontend.tmpl b/static/frontend/frontend.tmpl
index bf56147..5222a5d 100644
--- a/static/frontend/frontend.tmpl
+++ b/static/frontend/frontend.tmpl
@@ -37,17 +37,19 @@
   </head>
   <body>
     <!-- loadScript appends JS sources to the document head. It loads scripts as asynchronous
-        modules eliminating parser-blocking JavaScript. -->
+        modules by default, eliminating parser-blocking JavaScript. -->
     <script>
-      function loadScript(src) {
+      function loadScript(src, mod = true) {
         let s = document.createElement('script');
         s.src = src;
-        s.type = 'module';
-        s.async = true;
-        s.defer = true
+        if (mod) {
+          s.type = 'module';
+          s.async = true;
+          s.defer = true
+        }
         document.head.appendChild(s);
       }
-      loadScript("/third_party/dialog-polyfill/dialog-polyfill.js")
+      loadScript("/third_party/dialog-polyfill/dialog-polyfill.js", false)
       loadScript("/static/frontend/frontend.js");
     </script>
     {{template "header" .}}