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

Chrome extensions: Content script css does not appear to be loaded #16831

Open
Amy-Lynn opened this Issue Feb 8, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@Amy-Lynn
Copy link

Amy-Lynn commented Feb 8, 2019

  • Electron Version (output of node_modules/.bin/electron --version):
    • 4.0.0
  • Operating System (Platform and Version):
    • Windows 7 (7601)
  • Last known working Electron version (if applicable):
    • N/A

Expected Behavior

Manifest.json content script css files to be loaded into browser window

Actual behavior

Don't appear to be loaded

To Reproduce

Manifest.json snippet:

{
  "manifest_version": 2,
  "content_scripts": [
    {
      "matches": [
        "http://*/*",
        "https://*/*"
      ],
      "js": [
        "index.js"
      ],
      "css": ["style.css"]
    }
  ],
  "permissions": [
    "clipboardWrite",
    "activeTab",
    "background"
  ]
}

Code where I'm adding the browser extension:

BrowserWindow.addExtension(extensionPath);

const childWindow = new BrowserWindow({
webPreferences: {
  nodeIntegration: false
}
});

childWindow.setMenu(null);
childWindow.show();
childWindow.openDevTools();
childWindow.loadURL(url);

Additional Information

If I put at breakpoint at https://github.com/electron/electron/blob/master/lib/browser/chrome-extension.js#L262 , I can see that the CSS content is found and is being passed in

image

Looking in devtools, I can see that my javascript is loaded, but the CSS isn't there (and isn't affecting the page):

image

@welcome

This comment has been minimized.

Copy link

welcome bot commented Feb 8, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment