Skip to content

RequireJS resolver sometimes fails to detect blocked resources #28116

Closed
@ishakhsuvarov

Description

@ishakhsuvarov

Preconditions (*)

  1. Magento 2.3.5-p1. Most likely any recent release would be affected.

Steps to reproduce (*)

  1. Create a custom RequireJS config which defines a component complete with its url and fallback path. For example:
var config = {
    paths: {
        a: ['https://example.com/advertisement.js', 'Custom_Module/js/noop']
    }
};
  1. Include this component on Checkout (may be reproducible elsewhere)
<!-- Something simple like this would work: -->
<script type="text/x-magento-init">
    {
        "*": {
            "a": {}
        }
    }
</script>
  1. Use a browser with any aggressive Ad Blocker extension which would block the required url
  2. Open Checkout page

Expected result (*)

  1. ✅ Ad Blocker extension blocks the script download from the url stated in RequireJS config (https://example.com/advertisement.js)
  2. ✅ Checkout page loads and renders just fine

Actual result (*)

  1. ✅ Ad Blocker Extension blocks script download from the original url
  2. ℹ️ RequireJS uses path fallback mechanism to load a resource from second url, therefore not triggering an error.
  3. ℹ️ Magento's RequireJS resolver cannot keep track of such events and continues to wait for original resource to load (as no error was produced), therefore not calling any of the callbacks.
  4. ❌ Checkout page is displaying 2 spinning loaders and a fully rendered page under it as resolver does not track components which were loaded via fallbacks.

Metadata

Metadata

Assignees

Labels

Component: UiFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneRelease Line: 2.4Reported on 2.3.5-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: DoneHas been reviewed and prioritized during Triage with Product Managers

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions