This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
fix(listener): fix #616, webdriver removeEventListener throw permission denied error #699
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #616, and mozilla/geckodriver#515.
the issue just like angular/protractor#2784.
In cross site contexts (such as WebDriver frameworks like Selenium),
access eventHandler will throw permission denied error.
and in angular/protractor#2784, @juliemr fixed addEventListener,
in #616, firefox will also call removeEventListener , the code can be found here,
https://reviewboard.mozilla.org/r/98064/diff/12#index_header
so we need to do the same with addEventListener in removeEventListener to avoid
such issue.
https://github.com/JiaLiPassion/zone.js/blob/3fae05d347fde7e46cc8834158da74e544506877/lib/common/utils.ts#L320
in earlier fix, if data.handler.toString is permission denied, we do nothing, but in FF52+, toString() is not accessible, but we can still call native addEventListener/removeEventListener with the data.handler, so we can try to do that and try/catch to avoid error.
Firefox 52+, webdriver-manager 12.0.4+, selenium-webdriver 3.3.0+, and I will try to add it into travis/saucelabs after saucelabs support those newest browser/webdriver versions.