web-ext icon indicating copy to clipboard operation
web-ext copied to clipboard

fix: Fixes #1979 [opening of chrome:// url in cmdLine]

Open DeepikaKaranji opened this issue 5 years ago • 3 comments

This is a draft PR, work in progress.

A few doubts:

  1. I logged chromium binary and this.params, where chromiumBinary = this.params. chromiumBinary gives undefined, while this.params gives something like
extensions: [ { sourceDir: '/fake/sourceDir', manifestData: [Object] } ],
  keepProfileChanges: false,
  startUrl: undefined,
  chromiumLaunch: [Function],
  desktopNotifications: [Function]
}

May I know why?

  1. I have created a new message as directed by you to forward the chrome:// URL, but the wsClient is not defined. How do I know which port/ URL to send the message to the reloadManagerExtension?
  2. It is mentioned in the comments by rpl and you that extensions are able to open chrome:// url through chrome.tabs.query. While the reload message type had the key "type", I didnt know what the key for url should be in the message I constructed. How can I find that out? Thanks!

DeepikaKaranji avatar Oct 26 '20 16:10 DeepikaKaranji

This is a draft PR, work in progress.

A few doubts:

  1. I logged chromium binary and this.params, where chromiumBinary = this.params. chromiumBinary gives undefined, while this.params gives something like
extensions: [ { sourceDir: '/fake/sourceDir', manifestData: [Object] } ],
  keepProfileChanges: false,
  startUrl: undefined,
  chromiumLaunch: [Function],
  desktopNotifications: [Function]
}

May I know why?

Based on the fake data, I guess that you have run a unit test where those values weren't deemed relevant. For development of this feature, I suggest to use the actual program, because then you will be able to verify that the logic works as expected (to rule out test-specific issues). You can test the feature as follows:

  1. Create a directory containing a test extension (containing at least a valid manifest.json file).
  2. (build the program in your clone of the web-ext repo)
  3. Run ./path/to/your/github/web-ext/bin/web-ext run -t chromium -u chrome://extensions
  4. Verify that chrome://extension is opened as expected.

FYI, the web-ext command line interface is documented at: https://extensionworkshop.com/documentation/develop/web-ext-command-reference/

  1. I have created a new message as directed by you to forward the chrome:// URL, but the wsClient is not defined. How do I know which port/ URL to send the message to the reloadManagerExtension?

You don't need a port/URL. That would only be meaningful if you were a WebSocket client. But the extension runner (launched by web-ext) acts as a WebSocket server. The reload manager extension acts as its client (using the WebSocket API in the extension's background script).

As the server may potentially have multiple clients (or even none, but in practice one), there is a helper method (wssBroadcast) to broadcast a message to all clients (again, in practice there is only one such client). The reloadAllExtensions function is an example of a user of the method.

  1. It is mentioned in the comments by rpl and you that extensions are able to open chrome:// url through chrome.tabs.query. While the reload message type had the key "type", I didnt know what the key for url should be in the message I constructed. How can I find that out?

It's up to you to define a meaningful message. We already have the (common) convention of using type property to specify the message type, you can add more properties as you see fit for implementing the feature.

Rob--W avatar Oct 27 '20 20:10 Rob--W

PS. Put a reference to the bug that you're fixing in the pull request. This helps others who stumble on the other issue to see that some work is being done.

If the PR contains "Fixes #1979", then the other bug will automatically be closed when this bug is merged. For more info about this Github feature, see https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

Rob--W avatar Oct 27 '20 20:10 Rob--W

@DeepikaKaranji Do you need any help with moving this PR forwards?

Rob--W avatar Dec 03 '20 14:12 Rob--W

No activity for years, I am closing this PR. If you want to work on this issue in the future, just submit a new PR, thanks!

willdurand avatar Jan 19 '23 14:01 willdurand