magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

trackingCode.js blocked by Adblock Plus in checkout shipping step #13346

Closed thomas-kl1 closed 6 years ago

thomas-kl1 commented 6 years ago

Can't finalize order, checkout blocked due to script filename

Preconditions

  1. Magento 2.2.2, with or without sample data
  2. Chrome extension adblock plus installed

Steps to reproduce

  1. Add a product to cart
  2. Go to the cart
  3. Process to checkout

Expected result

  1. Complete shipping and payment steps

Actual result

  1. Step shipping with infinite loading, the following error appear in web client console: capture du 2018-01-24 11-03-13 capture du 2018-01-24 11-03-52

Final customers who have the adblock plus extension can't pass orders, I think they should have an alert message or the script should be renamed.

Suggestion

Every files blocked by an ad blocker shouldn't broke the core functionality (the files blocked are trackers, and does not impact the end user experience).

EDIT: same potential issues:

12828

12428

thomas-kl1 commented 6 years ago

It seems to be related to https://github.com/magento/magento2/issues/12828

orlangur commented 6 years ago

@thomas-blackbird this is actually a duplicate of https://github.com/magento/magento2/issues/12828.

Could you please check if the issue persists on 2.2-develop? It was fixed recently and not released yet, until then you can apply changes from mentioned commits to your instance manually.

thomas-kl1 commented 6 years ago

I have applied the changes in local (of this PR: https://github.com/magento/magento2/pull/13061/files), but it doesn't change anything... There's still the "wheel of horror" and the error above. I'll try with 2.2-developer later.

orlangur commented 6 years ago

@thomas-blackbird try setting breakpoint in lib/web/mage/apply/main.js at corresponding line in incognito mode. It has not chance to not work (or at least there should be another error displayed).

thomas-kl1 commented 6 years ago

I confirm that it do not block the other loads, however, (it seems to be specific for the checkout page, regarding the issue #12828 ), the loader is not ended and we can't continue.

My trace log, with the modification of the PR: issue_1 result in console log: issue_22 (above, script blocked by AdBlock Plus) issue_2

Actual result (everything is loaded fine, but the loader is not removed): issue_3

thomas-kl1 commented 6 years ago

It seems to be the same issue as https://github.com/magento/magento2/issues/12428

lingwooc commented 6 years ago

@thomas-blackbird Check you have the fix from the PR #13061 if so try a similar fix using JQuery to attempt a preload before letting require spray fail everywhere.

I can't make head nor tail of this mess. I just disabled the dot mailer crapware (you may not have the luxury) and applied my GA fix in my theme. Whoever designed this checkout is...not very good. Whoever does the testing is....also not very good. It's way too brittle.

thomas-kl1 commented 6 years ago

@lingwooc actually I have applied the fix of #13061 and it prevent to fail the load of the others scripts. However, and it seems specific to the checkout page, the loader widget don't stop, and so, the customer can't pass an order, which is a critical bug. (If he has an ad blocker of course, uBlock or adBlock Plus)

lingwooc commented 6 years ago

@thomas-blackbird I thought you probably had. Hmmm, if my jquery approach doesn't help and you can't disable dot mailer then I'm out of ideas.

I agree, that this is a critical issue. There have been assumptions in the design of this checkout (namely that everything will load) that clearly aren't true. The worst thing is that magento2.2.2 has been broken out of the box for commercial reasons.

thomas-kl1 commented 6 years ago

Well I don't know a lot about how requireJS is implemented in Magento, but it seems that the checkout loader Magento/Checkout/view/frontend/web/js/checkout-loader.js can't call the method hideLoader. Indeed in the method init the method hideLoader is passed as a callback to the magento requiredJS resolver, defined at: lib/mage/requirejs/resolver.js. Actually the checkout loader subscribe the end of the loader to the condition that all dependencies has been loaded (it's fair and logic).

What I've understood: the resolver is still in pending state because a dependence has not been loaded (trackingCode in our case). I don't know how it should be fixed and I'm not enough good to help, but I think that a level should exist and determine if a dependency is require or can be ignored if it failed while resolving.

magento-engcom-team commented 6 years ago

@thomas-blackbird, thank you for your report. We've acknowledged the issue and added to our backlog.

thomas-kl1 commented 6 years ago

It seems that the issue has been resolced in #14874 I'm closing the issue.

pratikhmehta commented 4 years ago

Open lib/mage/requirejs/resolver.js file.

   /**
     * Checks if provided module has unresolved dependencies.
     *
     * @param {Object} module - Module to be checked.
     * @returns {Boolean}
     */
    function isPending(module) {
        return !!module.depCount;
    }

Replace with this bellow code:

    /**
     * Checks if provided module is rejected during load.
     *
     * @param {Object} module - Module to be checked.
     * @return {Boolean}
     */
    function isRejected(module) {
        return registry[module.id] && (registry[module.id].inited || registry[module.id].error);
    }

    /**
     * Checks if provided module has unresolved dependencies.
     *
     * @param {Object} module - Module to be checked.
     * @returns {Boolean}
     */
    function isPending(module) {
        if (!module.depCount) {
            return false;
        }

        return module.depCount > _.filter(module.depMaps, isRejected).length;
    }

Best solution, It works for me.

Thanks