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

urlFilter with wildcard does not match root URL #834

Closed
geirsagberg opened this issue Jan 22, 2020 · 5 comments
Closed

urlFilter with wildcard does not match root URL #834

geirsagberg opened this issue Jan 22, 2020 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@geirsagberg
Copy link

  • VS Code Version: 1.41.1
  • Log file (set "trace": true in launch config): N/A

Steps to reproduce:

  1. Using the following launch.json:
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "edge",
      "request": "attach",
      "name": "Attach Edge",
      "urlFilter": "https://localhost:3000/*",
      "webRoot": "${workspaceFolder}/Portal/apps",
      "sourceMaps": true,
      "smartStep": true,
      "skipFiles": ["**/node_modules/**"],
      "sourceMapPathOverrides": {
        "webpack:///*": "${webRoot}/*"
      },
      "port": 2015
    }
  ]
}
  1. Attaching works when a tab is open on a sub-page, e.g https://localhost:3000/home.
  2. Attaching does not work when the tab is open on the root URL, e.g. https://localhost:3000.

I would expect the wildcard to match anything or nothing. Or else there should be an operator for optional wildcard.

@roblourens
Copy link
Member

Probably works if it ends with 3000* right?

@geirsagberg
Copy link
Author

@roblourens Thanks for the tip, that does the trick! Only issue I can see is that it will also match localhost:30000.

While this is sufficient for my use case, it would probably be more user-friendly if trailing /* was replaced with *, to fit with the principle of least surprise. It seems like this is already done if there is no wildcard: https://github.com/microsoft/vscode-chrome-debug-core/blob/283e6b4e09f0528e8ecf2f21cb1cf57ef6666ce7/src/chrome/chromeUtils.ts#L191

Feel free to close this bug if you disagree though, the workaround is good enough for me :)

@roblourens
Copy link
Member

I agree!

@AltitudeApps
Copy link

AltitudeApps commented Aug 22, 2020

TL;DR: I really want to use "urlFilter" too, but with both a wildcard and complicated parameters containing special characters.

Ok, this might not be the right place to put this, because I don't think I'm using vscode-chrome-debug directly. I am developing an office-js add-in for Excel, and I ended up here because I am having trouble with a launch configuration.

What I am using is the "Microsoft Office Add-in Debugger for Visual Studio Code", the repo for which is here: vscode-debugger-extension-for-office-addins . The source code is no longer offered in that repo, but by looking at the files which get installed, I can see that it is using vscode-chrome-debug-core, and I suspect that I'm being denied the functionality I desire by the code at or near the line which has been referenced above. I haven't traced this all the way, stepping through the source code, admittedly... but I have my suspicions. So, maybe this is the right place to start...

Without the ability to use urls with wildcards and complicated parameters, I face the prospect of needing to have a separate launch configuration for each task pane, or whatever little hosted stub page is involved with the project.

launch.json excerpt:

{
// ... omitted
  "configurations": [
    {
      "name": "Excel Desktop",
      "type": "node",
      "request": "launch",
      // ...  yadda yadda
    },
    {
      "type": "office-addin",
      "request": "attach",
      "name": "storepane - attach to taskpaneStoreId",
      "port": 9222,
      "trace": "verbose",

      //  this doesn't work...
      // "urlFilter":
      //   "https://localhost:3000/*.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      //                         ^^^^^   omg, i can haz wildcard, plz? 

      //  this doesn't either...
      // "urlFilter":
      //    "https://localhost:3000*.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      //                                  I $uspect it'$ choking on thi$, $omhow...

      "url":
        "https://localhost:3000/taskpane1.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      //  this works, but requires the user to have a separate launch
      //  configuration for each .html host page in the project, of which
      //  there can be many.

      "webRoot": "${workspaceFolder}",
      "timeout": 45000
    },
// ... file continues ...

My hypothesis is that getMatchingTargets() is returning an empty array, as a result of the goofy url with too many dollar signs I'm required to use.

I have mentioned this issue over in that repo:
OfficeDev/vscode-debugger-extension-for-office-addins#17 (comment)

@connor4312
Copy link
Member

I noticed this issue in js-debug (our new debugger) a week or two ago as well, will transfer this issue, fix, and close it

@connor4312 connor4312 assigned connor4312 and unassigned roblourens Nov 3, 2020
@connor4312 connor4312 transferred this issue from microsoft/vscode-chrome-debug Nov 3, 2020
@connor4312 connor4312 added this to the November 2020 milestone Nov 3, 2020
@connor4312 connor4312 added the bug Issue identified by VS Code Team member as probable bug label Nov 3, 2020
digeff pushed a commit that referenced this issue Nov 9, 2020
@roblourens roblourens added the verified Verification succeeded label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants