question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content-scripts are not injected correctly

See original GitHub issue

NWJS Version: 0.49.x, 0.50.x Operating System: Win 10

Expected behavior

Insert content-scripts correctly, works fine in NWjs 0.47.3 and NWjs 0.48.4

Actual behavior

Sometimes, after init/load webview and injection content-scripts (via webview.addContentScripts).

How to reproduce

  1. Example.zip
    • contentscript.js - injected to webview, easy example for chrome.runtime communictaion, example showing command message hello-world from webview to window.
      connection.command('hello-world', null, (returnData) => console.log(returnData));
      
    • window2.js - chrome.runtime.onMessage, return to webview ‘Hi!’, if receive hello-word message.
  2. Run with NWjs, check devtools (shown automatically)
  3. Some startup, incialized wrong, missing contentscript.js 2020-10-16 14 21 43
  4. Some startup, incialized ok 2020-10-16 14 22 33

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:29 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
corwin-of-ambercommented, Nov 13, 2020

Actually @TheJaredWilcurt, I have tested it a bit more (on macOS) and indeed when I reload the window (that is, Ctrl+R in the devtools window) rather than quit & relaunch, the generated_script_file (the one that holds params) is missing about one out of three times.

When quitting & relaunching, it is always there.

1reaction
panther7commented, Nov 13, 2020

@corwin-of-amber Thanks for suggest, but it still is not fixed.

2020-11-13 15 52 40

or sometimes

2020-11-13 15 56 19

I hate these random issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome extension content scripts are not injected in the first ...
After reloading the page all scripts are injected correctly, and my extension works as expected. What can be the reason for that, and...
Read more >
Content scripts do not inject into frames with no src ... - Monorail
Issue 76429: Content scripts do not inject into frames with no src because their url is "about:blank" · 1. create an extension with...
Read more >
Content Scripts - Google Chrome Extensions
The content script will be injected into a page if its URL matches any matches pattern and any include_globs pattern, as long as...
Read more >
Injecting a script tag from a content script to an iframe with ...
I'm working on an extension that injects a piece of code into iframes. I'm using manifest v3 and I have a content script...
Read more >
Chrome Extension Tutorial: How to Pass Messages from a ...
Content Scripts have easy access to the DOM of the web page. We make use of the content script to append our custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found