System Information:
macOS or iOS version: Unrelated
Userscripts version: v4.1.0, v.1.1.0
Safari version: Unrelated
Is this issue related to script injection? Seemingly
Did the test script (pasted above) successfully run on your machine? Yes
When I discovered this metadata:
// @match *://www.google.com/*
Can't match the userscript when browser open URL like this:
https://www.google.com/preferences?prev=https://www.google.com/
I spent a lot of time to read the source code, and I think I found where the problem.
|
func getUrlProps(_ url: String) -> [String: String]? { |
|
let pattern = #"^(.*:)\/\/((?:\*\.)?(?:[a-z0-9-:]+\.?)+(?:[a-z0-9]+))(\/.*)?$"# |
|
let regex = try! NSRegularExpression(pattern: pattern, options: .caseInsensitive) |
I made an online demonstration to show how it matches the web page URL and what kind of problems.
I believe it is obvious:
https://regex101.com/r/xs43bS/1
At first I thought it was a @match matching problem, but by looking at the source code, because this occurred in the webpage URL matching stage, I assumed that it should also affect @include and other metadata.
System Information:
When I discovered this metadata:
// @match *://www.google.com/*Can't match the userscript when browser open URL like this:
https://www.google.com/preferences?prev=https://www.google.com/I spent a lot of time to read the source code, and I think I found where the problem.
userscripts/extension/Userscripts Extension/Functions.swift
Lines 935 to 937 in 16a23bd
I made an online demonstration to show how it matches the web page URL and what kind of problems.
I believe it is obvious:
https://regex101.com/r/xs43bS/1
At first I thought it was a
@matchmatching problem, but by looking at the source code, because this occurred in the webpage URL matching stage, I assumed that it should also affect@includeand other metadata.