-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
The include directive is not working in Firefox 68.0.2 #302
Comments
Hello @acebone, thanks for your report. It seems that Firefox now throws a
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/65 Not sure if it's related and/or if it's intented because we are using a var data = '';
var status = -1;
try {
var xhr = new XMLHttpRequest();
xhr.open('GET', path, false);
xhr.addEventListener('load', function() {
status = this.status;
// status is 0 for local file mode (i.e., file://)
if (status === 0 || status === 200) {
data = this.responseText;
}
});
xhr.overrideMimeType('text/plain');
xhr.send();
}
catch (e) {
throw $$($nesting, 'IOError').$new('Error reading file or directory: ' + path + '; reason: ' + e.message);
}
// assume that no data in local file mode means it doesn't exist
if (status === 404 || (status === 0 && !data)) {
throw $$($nesting, 'IOError').$new('No such file or directory: ' + path);
}
return data; And the following exception is thrown: {
"code": 19,
"columnNumber": 0,
"data": null,
"filename": "moz-extension://cd380291-0789-b247-9c89-203d6aa6146d/js/vendor/asciidoctor.js",
"lineNumber": 19999,
"message": "A network error occurred.",
"name": "NetworkError",
"result": 2152923155
} I tried to use a local HTTP server but I got the following error/warning:
So I'm not sure what is happening... but it's important to note that it's working fine in Chrome (with the same code). |
It's also working in Firefox 66 (on Linux). |
Apparently they blocked it for security reasons: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/68#Security so the include directive won't work when using the |
@acebone You can try to change |
The complete procedure:
|
I had a computer-crash and I've been reconstructing my setup on a new machine. I'll return with my results shortly |
68.0.2 (64-bit) for Ubuntu, the change to |
Thanks @gizzmojr, I will add the procedure to the README 👍 |
I'm now on FF 78.0.2 (ubuntu 19.10) and this doesn't work (sry for the long delay in answering) |
I just did a quick test on 78.0.2 (Ubuntu 18.04) with the following document and it's working: main.adoc
tip-version.adoc
Could you please provide a sample document to reproduce this with the error messages in the background page and/or in the main page (if any)? |
No error message, but file is not included. Trying to include a custom global config file (the file path is verified). This line:
gives this error:
This line:
gives this error:
The following is working:
|
Not sure if it's a type but you need an empty line are the document title.
It should be:
Using an absolute path also works on my machine. What is the URL of the main document? Go to doc.adoc
All of the above is working. I see "Dropbox" in the path, maybe it interferes with the XMLHttpRequest? |
I'm not using Dropbox actually, it's just a leftover from way back. There is a problem with the include mechanism, but it's quite different from what I thought, so I am in the wrong bugreport-thread altogether. Sorry about that. The problem seems to be, that I can only include files further down the filepath Given the files /home/esm/main1.adoc /home/esm/adtest/main2.adoc the main1.adoc will be able to include all the other files, but main2.adoc will only be able to include include2.adoc I've set safe mode to 'unsafe' The include-mechanism works as expected with commandline asciidoctor. |
No I think it's the same issue because it sounds like a restriction in the origin policy from Firefox.
I'm 99% sure that this is a restriction in Firefox (not in Asciidoctor.js). |
It works! Nice! Perhaps leave a note about this in the readme or elsewhere? Thanks for your patient help :) |
I also ran into this, because I wanted to include global settings (from the main folder) in each chapter file (which are in their own folders), so that I can view those files on their own with the global confinguration. Is there a way without weakening Firefoxs security? |
Should we include this in the refresh of the README.adoc here #648 ? FireFox is now at v113.2 |
If my workaround is still working with the latest version, yes we should. Also, I think we should include the version of the browser (i.e., "workaround tested on Firefox 113.2) |
Include has always been funky with this web-extension - In FF64 I can get it to include a file in the same directory, but it will not include that very same file if it's placed anywhere else ie. in a subfolder of the main file directory.
However with FF68.0.2 I can't include anything at all, and looking at the extensions page I get the errors shown in the attached screenshot
I'd be more than happy to assist in getting the extension to include as it should in all versions of FF. But I wouldn't know how to go about it.
The text was updated successfully, but these errors were encountered: