Last Comment Bug 856913 - MatchPattern incorrectly matches patterns with wildcard
: MatchPattern incorrectly matches patterns with wildcard
Status: RESOLVED FIXED
:
Product: Add-on SDK
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All All
: P2 normal with 1 vote (vote)
: mozilla23
Assigned To: Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-01 19:44 PDT by fxrock2002
Modified: 2016-03-21 09:48 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
GH Pull Request 923 (379 bytes, patch)
2013-04-04 12:27 PDT, Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile)
no flags Details | Diff | Splinter Review
GH Pull Request 923 (379 bytes, text/plain)
2013-04-04 12:29 PDT, Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile)
zer0: review-
Details
GH Pull Request 923 (379 bytes, text/plain)
2013-04-04 20:40 PDT, Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile)
zer0: review+
Details

Description fxrock2002 2013-04-01 19:44:14 PDT
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
Comment 1 Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile) 2013-04-04 12:24:01 PDT
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');
Comment 2 Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile) 2013-04-04 12:27:39 PDT
Created attachment 733496 [details] [diff] [review]
GH Pull Request 923
Comment 3 Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile) 2013-04-04 12:29:11 PDT
Created attachment 733497 [details]
GH Pull Request 923
Comment 4 Matteo Ferretti [:zer0] [:matteo] 2013-04-04 18:53:04 PDT
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.
Comment 5 Jordan Santell [:jsantell] [@jsantell] (Away from Bugzilla for awhile) 2013-04-04 20:40:10 PDT
Created attachment 733715 [details]
GH Pull Request 923
Comment 6 [github robot] 2013-04-04 21:27:02 PDT
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
Comment 7 fxrock2002 2013-07-18 16:05:16 PDT
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?
Comment 8 Wes Kocher (:KWierso) 2013-07-18 16:13:34 PDT
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
Comment 9 heena280791 2016-03-21 09:48:35 PDT
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>

Note You need to log in before you can comment on or make changes to this bug.