Skip to content
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

XML pretty-print is broken if used in browser extension content scripts #4001

Closed
varjolintu opened this issue Mar 6, 2018 · 6 comments
Closed

Comments

@varjolintu
Copy link

Description

Pretty-printing XML files fail if jQuery is used as a content script in a browser extension.
If XML and XSD files are excluded from the contect scripts in manifest.json it works, but then files without .xml/.xsd filename ending still print XML files wrong. I have confirmed that this is related to jQuery because removing it from the contect scripts resolves the issue.

Also, please see related issues:
keepassxreboot/keepassxc-browser#50
smorks/keepasshttp-connector#32

Link to test case

Quite simple test page: https://www.w3schools.com/xml/simple.xml which can be used with for example KeePassXC-Browser or KeePassHTTP-Connector browser extensions.

@timmywil
Copy link
Member

timmywil commented Mar 6, 2018

Thank you for opening an issue, but you'll need to be more specific and create a test case in https://jsbin.com or https://jsfiddle.net demonstrating an issue in jQuery.

@timmywil timmywil closed this as completed Mar 6, 2018
@varjolintu
Copy link
Author

Doing a test case with those sites is not possible. You cannot include a XML file inside an iframe so those kind of tests could be done.

To be more specific you can test this in the following way:

  1. Download the browser extension sources from https://github.com/keepassxreboot/keepassxc-browser
  2. Open manifest.json file and remove exclude_matches part under content_scripts
  3. Open Firefox and add the extension manually via about:debugging and choose Load Temporary Add-on
  4. Go to https://www.w3schools.com/xml/simple.xml and you can see the XML file is converted to a text file.

@timmywil
Copy link
Member

timmywil commented Mar 6, 2018

I understand that you're saying excluding jQuery fixes the issue, but that could not be less specific. What is jQuery doing to cause the problem? We are all volunteers and even if we had the time to help debug this issue, it may still lead to the discovery that jQuery is working as intended.

@varjolintu
Copy link
Author

I understand it's not an easy process. If any of the volunteers could help and maybe give some points where to start looking at the issue, then I could try to find the exact point by myself.

@dmethvin
Copy link
Member

dmethvin commented Mar 6, 2018

jQuery can manipulate an XML document and can run in an XHTML document but it's not meant to be included into an XML document directly. I'm not very familiar with Firefox plugins but this page seems to indicate the script is being injected into the plain XML page. That is not a scenario I'd expect to work at all.

@varjolintu
Copy link
Author

Yes. The script is injected to the content. It's not a new thing to include jQuery and jQueryUI as a content script. Maybe I need to look for alternative methods to do modal dialogs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants