Hello,

When Quickedit is activate I have got this message in Chrome console : Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
However, the module works well

When I try to find the bug in Quickedit.js, this line is cause of problem :
entityElement.setAttribute('data-quickedit-entity-instance-id', entityInstanceID);

Thanks in advance.

Files: 
CommentFileSizeAuthor
#14 Screen Shot 2017-02-09 at 11.02.07 AM.png290.37 KBjsulmar

Comments

musikscontact created an issue. See original summary.

Wim Leers’s picture

Title: Synchronous XMLHttpRequest on Quickedit module » Browser console warning: "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/."
Component: quickedit.module » ajax system
Status: Needs review » Active
Issue tags: +JavaScript

Thanks for reporting this! This warning has also bothered me a lot.

When trying to find the root cause, it blames jQuery.ajax(). When I set breakpoints in there, Chrome doesn't allow me to inspect any of the variables. When I add logging, Chrome doesn't log it. What the hell?

In any case, Quick Edit doesn't do anything special, it merely uses the AJAX system.

droplet’s picture

Insertion of the SCRIPT tag caused the problem.
https://github.com/jquery/jquery/issues/1895

Wim Leers’s picture

Issue tags: +Needs upstream bugfix

Aha!

sukanya.ramakrishnan’s picture

any updates on this one? am getting this error with an ajax view and once this errors throws up custom javascript behaves very inconsistently?

regards
Sukanya

DanielVeza’s picture

I just had the same issue as sukanya.ramakrishnan.

While the notice was there my custom JS wouldn't work correctly. As soon as I disabled quickedit the warning disappeared and the js worked as expected.

droplet’s picture

In general, the warning won't break the JS executions but slow down the responses. What's your browser version? and any steps to reproduce?

Looking at Network Tab in Chrome for the JS loading. If you can, right click and save the HAR in network and Timeline data to us.

Could it be this issue?
#1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS
(Even not this issue, the patch may sort the problem. It loads JS async instead)

Wim Leers’s picture

(Even not this issue, the patch may sort the problem. It loads JS async instead)

Indeed.

jimafisk’s picture

DanielVeza - Thanks for the tip in #6, that worked for me. Disabling QuickEdit allowed my custom javascript to work properly again.

droplet’s picture

@Wim,

Can we defer that 2 scripts loading (plainTextEditor & formEditor) until actual usages of QuickEditor (after first Quick edit click)? It always good, not just for this issue. I think 90%+ admin page load are not used Quick Edit (& contextual link)

Ajax loaded scripts in Drupal missed cache hit. On a slow network, it could be one sec or more delay.

clemens.tolboom’s picture

Version: 8.0.0 » 8.3.x-dev
Skin’s picture

worked for me: after disabling quick edit the warning disappeared an the site become fast again.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jsulmar’s picture

I observe this warning with Chrome only when a custom block is visible AND QuickEdit is enabled. The warning is not caught by Firefox/Firebug. If it helps, attached is a screen shot from the Chrome console.