Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: inject.preload.js

Issue 29890555: Issue 6914 - Wrap window.frameElement in try catch to silence Microsoft Edge exception (Closed)
Patch Set: Created Sept. 24, 2018, 11:21 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: inject.preload.js
diff --git a/inject.preload.js b/inject.preload.js
index 0f81da6f8ff60ea4a108ef87e307dc908f1d50a3..c5d663cefa10af5c9271a8b43eaa7ab18b0559ce 100644
--- a/inject.preload.js
+++ b/inject.preload.js
@@ -357,8 +357,17 @@ function injected(eventName, injectedIntoContentWindow)
if (document instanceof HTMLDocument)
{
- let sandbox = window.frameElement &&
- window.frameElement.getAttribute("sandbox");
+ let sandbox;
+
+ // We have to wrap the following code in a try catch
+ // because of this Microsoft Edge bug:
+ // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/19082980/
+ try
+ {
+ sandbox = window.frameElement &&
+ window.frameElement.getAttribute("sandbox");
+ }
+ catch (e) {}
if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox))
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld