asciidoctor.js icon indicating copy to clipboard operation
asciidoctor.js copied to clipboard

Chromium: XMLHttpRequest.open() warning with local includes

Open Neved4 opened this issue 4 years ago • 1 comments

Affects Asciidoctor.js Live Preview 2.6.0.1 and previous 2.5.0 in Chromium-based web browsers.

Description

Using the include::file.adoc[] declaration in a document will trigger several warnings. It does not prevent proper display of the document.

Steps to reproduce

  1. Try to preview a file that includes a different one
= My Document

include::file.adoc[]

Details

Error Message

Synchronous XMLHttpRequest on the main thread is deprecated
because of its detrimental effects to the end user's experience.
For more help, check https://xhr.spec.whatwg.org/.

Context

_generated_background_page.html

Stack Trace

js/vendor/asciidoctor.js:19990 ($read)

19990   xhr.open('GET', path, false);

Relevant Lines

https://github.com/asciidoctor/asciidoctor.js/blob/19b25a5481b053d2008cabaee4b5ae0c8ca0288a/packages/core/lib/asciidoctor/js/opal_ext/browser/file.rb#L9

Possibly Related

#630, #644

Attachments

Screenshot


Neved4 avatar Jun 11 '20 17:06 Neved4

Unfortunately, we cannot use an asynchronous XMLHttpRequest because the code of Asciidoctor.js is transpiled from Ruby and the code has to be synchronous.

This issue will most likely be fixed in the upcoming JavaScript compatible implementation of the AsciiDoc specification.

ggrossetie avatar Jun 12 '20 08:06 ggrossetie