Closed Bug 856913 Opened 13 years ago Closed 13 years ago

MatchPattern incorrectly matches patterns with wildcard

Categories

(Add-on SDK Graveyard :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla23

People

(Reporter: fxrock2002, Assigned: jsantell)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.70 Safari/537.17 Steps to reproduce: According to the match-pattern documentation: "A domain name prefixed with an asterisk and dot matches any URL of that domain or a subdomain, using any of http, https, ftp." However, I have a MatchPattern setup to match "*.ign.com" and ANYTHING that ends in ign.com is matched. For example: design.com is matched, and even activesouldesign.com is matched. These are not subdomains of ign.com. A regular expression would be a workaround, but this defeats the purpose of having wildcards as an alternative for developer ease-of-use. https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/page-mod/match-pattern.html Actual results: console.log(new MatchPattern('*.ign.com').test('http://ign.com')); // true console.log(new MatchPattern('*.ign.com').test('http://www.ign.com')); // true console.log(new MatchPattern('*.ign.com').test('http://www.design.com')); // true console.log(new MatchPattern('*.ign.com').test('http://activesouldesign.com')); // true Expected results: console.log(new MatchPattern('*.ign.com').test('http://ign.com')); // true console.log(new MatchPattern('*.ign.com').test('http://www.ign.com')); // true console.log(new MatchPattern('*.ign.com').test('http://www.design.com')); // false console.log(new MatchPattern('*.ign.com').test('http://activesouldesign.com')); // false
Assignee: nobody → jsantell
Thanks fxrock, the following tests will now correctly fail once patched ok('*.ign.com', 'http://www.design.com'); ok('*.ign.com', 'http://design.com'); ok('*.zilla.com', 'http://bugzilla.mozilla.com'); ok('*.zilla.com', 'http://mo-zilla.com');
Attached file GH Pull Request 923
Attachment #733497 - Flags: review?(zer0)
Comment on attachment 733497 [details] GH Pull Request 923 Good catch! But I see some issues in your implementation. Take a look to the comments I wrote on Github.
Attachment #733497 - Flags: review?(zer0) → review-
Attached file GH Pull Request 923
Attachment #733715 - Flags: review?(zer0)
Attachment #733715 - Flags: review?(zer0) → review+
Commit pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/f36c6dac5ad2ac4c3757b17b157f162614cc8591 Merge pull request #923 from jsantell/fix-matchpattern-856913 Fix Bug 856913, fix match pattern wildcard to not match invalid domains, r=@ZER0
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Still experiencing this bug with the latest add-on sdk 1.14 and firefox 22. How can I see what version the fix will be included in?
I believe this landed for Firefox 23, and the version of this file in the the Firefox23 branch of the SDK looks like it contains this patch: https://github.com/mozilla/addon-sdk/blob/firefox23/lib/sdk/page-mod/match-pattern.js
Target Milestone: --- → mozilla23
dies ist Geburtstagswünsche Blog. hier finden Sie am besten Zitate, sms für Wunsch, den Ihr Freund, ein Familienmitglied und alle Ihre liebevolle Person erhalten <a href="http://www.geburtstagswuensche4u.com/">Geburtstagswünsche</a>
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: