-
Notifications
You must be signed in to change notification settings - Fork 13
Fix opener access errors #133
Fix opener access errors #133
Conversation
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
+ Coverage 86% 88.46% +2.46%
==========================================
Files 2 2
Lines 50 52 +2
Branches 16 16
==========================================
+ Hits 43 46 +3
+ Misses 6 5 -1
Partials 1 1
Continue to review full report at Codecov.
|
On Chrome 69, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine to mute the errors here for now. Error reporting in the setup itself is always tricky...
src/__tests__/index.browser.js
Outdated
|
||
app.register(ErrorHandlingPlugin); | ||
|
||
getSimulator(app); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
t.doesNotThrow(() => getSimulator(app));
@dennisgl thanks for the quick review. I've pushed a commit with the explicit exception check. |
!merge |
Currently, if a page with this plugin is opened after clicking a link from an external domain, an error is thrown during app initialisation:
DOMException: Blocked a frame with origin "https://<my_domain>" from accessing a cross-origin frame.
This is due to Chrome preventing any (even read) access to
window.opener
in such cases.This PR provides a test case + fixes the issue by adding a try/catch around the event binding. I possibly could have gone with a known-blacklist but IMO this is a safe, future-proof approach.