Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blocked a frame with origin #16887

Merged
merged 3 commits into from
Nov 6, 2018

Conversation

iGerchak
Copy link
Contributor

Preconditions

  1. Magento 2.2.3 or 2.2.4 or 2.2.5
  2. Add the following script to the product page:
    <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Steps to reproduce

  1. Flush cache
  2. Open dev-console in your browser
  3. Reload page many times

Expected result

Console without errors

Actual result

  1. Sometime we'll have this error:
    console

Tech notes

Time to time created iframe on following line: https://github.com/magento/magento2/blob/2.2-develop/lib/web/jquery.js#L3123

Our change add try-catch to this method, and when error appears - we just returning an empty array.

@magento-engcom-team
Copy link
Contributor

Hi @iGerchak. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@ihor-sviziev ihor-sviziev requested review from orlangur and VladimirZaets and removed request for orlangur July 18, 2018 06:38
Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed with @VladimirZaets in slack - probable root of the issue - using object by refference that could change during the validation and cause such issue, another thing - validation might be not really good. Lets try to improve validation or clone iframe element before validation just to have only one state during processing. But currently solution is not really good because it's hiding an actual issue.

@magento-engcom-team
Copy link
Contributor

@iGerchak thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@iGerchak
Copy link
Contributor Author

@ihor-sviziev, I tried to make a clone of the object and work with it, but this solution does not fix the issue with the jQuery error in console.

elem.contentDocument || (elem.contentWindow ? elem.contentWindow.document : []) :
$.merge([], elem.childNodes);
} catch (e) {
return [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add logging of this exception as "warning" using "Magento/Ui/view/base/web/js/lib/logger/console-logger.js"

@sidolov
Copy link
Contributor

sidolov commented Aug 30, 2018

Hi @iGerchak , I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@sidolov sidolov closed this Aug 30, 2018
@ihor-sviziev ihor-sviziev reopened this Sep 14, 2018
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-2973 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-2973 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit 3bf066a into magento:2.2-develop Nov 6, 2018
@magento-engcom-team
Copy link
Contributor

Hi @iGerchak. Thank you for your contribution.
We will aim to release these changes as part of 2.2.8.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants