aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html
diff options
context:
space:
mode:
authorFlorian Dieminger <me@fiji-flo.de>2021-02-11 18:27:33 +0100
committerGitHub <noreply@github.com>2021-02-11 18:27:33 +0100
commit609ee7efcfe881caa08237948e1ed3252e60afa1 (patch)
treee8c22089de06c8ef1a6d75a6e0d1e893403cd07a /files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html
parentad7f998115dd568832332484debf1f1b16b0c905 (diff)
parent8519a85da1acd5b7863268b6cf6f9e4fd14bcf31 (diff)
downloadtranslated-content-609ee7efcfe881caa08237948e1ed3252e60afa1.tar.gz
translated-content-609ee7efcfe881caa08237948e1ed3252e60afa1.tar.bz2
translated-content-609ee7efcfe881caa08237948e1ed3252e60afa1.zip
Merge pull request #43 from fiji-flo/unslugging-pt-pt
Unslugging pt pt
Diffstat (limited to 'files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html')
-rw-r--r--files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html431
1 files changed, 431 insertions, 0 deletions
diff --git a/files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html b/files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html
new file mode 100644
index 0000000000..e7330b3010
--- /dev/null
+++ b/files/pt-pt/mozilla/add-ons/webextensions/match_patterns/index.html
@@ -0,0 +1,431 @@
+---
+title: dubla padrões em extensão manifestos
+slug: Mozilla/Add-ons/WebExtensions/Match_patterns
+translation_of: Mozilla/Add-ons/WebExtensions/Match_patterns
+original_slug: Mozilla/Add-ons/WebExtensions/dubla_padrões
+---
+<div>{{AddonSidebar}}</div>
+
+<p>Match patterns are a way to specify groups of URLs: a match pattern matches a specific set of URLs. They are used in WebExtensions APIs in a few places, most notably to specify which documents to load <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> into, and to specify which URLs to add <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest">webRequest</a></code> listeners to.</p>
+
+<p>APIs that use match patterns usually accept a list of match patterns, and will perform the appropriate action if the URL matches any of the patterns. See, for example, the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code> key in manifest.json.</p>
+
+<h2 id="Match_pattern_structure">Match pattern structure</h2>
+
+<div class="note">
+<p><strong>Note:</strong> Some browsers don’t support certain schemes.<br>
+ Check the <a href="#Browser_compatibility">Browser compatibility table</a> for details.</p>
+</div>
+
+<p>All match patterns are specified as strings. Apart from the special <code><a href="/en-US/Add-ons/WebExtensions/Match_patterns#%3Call_urls%3E">&lt;all_urls&gt;</a></code> pattern, match patterns consist of three parts: <em>scheme</em>, <em>host</em>, and <em>path</em>. The scheme and host are separated by <code>://</code>.</p>
+
+<pre>&lt;scheme&gt;://&lt;host&gt;&lt;path&gt;</pre>
+
+<h3 id="scheme">scheme</h3>
+
+<p>The <em>scheme</em> component may take one of two forms:</p>
+
+<table class="fullwidth-table standard-table">
+ <thead>
+ <tr>
+ <th scope="col" style="width: 50%;">Form</th>
+ <th scope="col">Matches</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>*</code></td>
+ <td>Only "http" and "https" and in some browsers also <a href="/en-US/docs/Web/API/WebSockets_API">"ws" and "wss"</a>.</td>
+ </tr>
+ <tr>
+ <td>One of <code>http</code>, <code>https</code>, <code>ws</code>, <code>wss</code>, <code>ftp</code>, <code>ftps</code>, <code>data</code> or <code>file</code>.</td>
+ <td>Only the given scheme.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h3 id="host">host</h3>
+
+<p>The <em>host</em> component may take one of three forms:</p>
+
+<table class="fullwidth-table standard-table">
+ <thead>
+ <tr>
+ <th scope="col" style="width: 50%;">Form</th>
+ <th scope="col">Matches</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>*</code></td>
+ <td>Any host.</td>
+ </tr>
+ <tr>
+ <td><code>*.</code> followed by part of the hostname.</td>
+ <td>The given host and any of its subdomains.</td>
+ </tr>
+ <tr>
+ <td>A complete hostname, without wildcards.</td>
+ <td>Only the given host.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p><em>host</em> must not include a port number.</p>
+
+<p><em>host</em> is optional only if the <em>scheme</em> is "file".</p>
+
+<p>Note that the wildcard may only appear at the start.</p>
+
+<h3 id="path">path</h3>
+
+<p>The <em>path</em> component must begin with a <code>/</code>.</p>
+
+<p>After that, it may subsequently contain any combination of the <code>*</code> wildcard and any of the characters that are allowed in URL paths or query strings. Unlike <em>host</em>, the <em>path</em> component may contain the <code>*</code> wildcard in the middle or at the end, and the <code>*</code> wildcard may appear more than once.</p>
+
+<p>The value for the <em>path</em> matches against the string which is the URL path plus the <a href="https://en.wikipedia.org/wiki/Query_string">URL query string</a>. This includes the <code>?</code> between the two, if the query string is present in the URL. For example, if you want to match URLs on any domain where the URL path ends with <code>foo.bar</code>, then you need to use an array of Match Patterns like <code>['*://*/*foo.bar', '*://*/*foo.bar?*']</code>. The <code>?*</code> is needed, rather than just <code>bar*</code>, in order to anchor the ending <code>*</code> as applying to the URL query string and not some portion of the URL path.</p>
+
+<p>Neither the <a href="https://en.wikipedia.org/wiki/Fragment_identifier">URL fragment identifier</a>, nor the <code>#</code> which precedes it, are considered as part of the <em>path</em>.</p>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: The path pattern string should not include a port number. Adding a port, as in: <em>"http://localhost:1234/*" </em>causes the match pattern to be ignored. However, "<em>http://localhost:1234</em>" will match with "<em>http://localhost/*</em>"</p>
+</div>
+
+<h3 id="&lt;all_urls>">&lt;all_urls&gt;</h3>
+
+<p>The special value <code>&lt;all_urls&gt;</code> matches all URLs under any of the supported schemes: that is "http", "https", "ws", "wss", "ftp", "data", and "file".</p>
+
+<h2 id="Examples">Examples</h2>
+
+<table class="fullwidth-table standard-table">
+ <thead>
+ <tr>
+ <th scope="col" style="width: 33%;">Pattern</th>
+ <th scope="col" style="width: 33%;">Example matches</th>
+ <th scope="col" style="width: 33%;">Example non-matches</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <p><code>&lt;all_urls&gt;</code></p>
+
+ <p>Match all URLs.</p>
+ </td>
+ <td>
+ <p><code>http://example.org/</code></p>
+
+ <p><code>https://a.org/some/path/</code></p>
+
+ <p><code>ws://sockets.somewhere.org/</code></p>
+
+ <p><code>wss://ws.example.com/stuff/</code></p>
+
+ <p><code>ftp://files.somewhere.org/</code></p>
+
+ <p><code>ftps://files.somewhere.org/</code></p>
+ </td>
+ <td>
+ <p><code>resource://a/b/c/</code><br>
+ (unsupported scheme)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>*://*/*</code></p>
+
+ <p>Match all HTTP, HTTPS and WebSocket URLs.</p>
+ </td>
+ <td>
+ <p><code>http://example.org/</code></p>
+
+ <p><code>https://a.org/some/path/</code></p>
+
+ <p><code>ws://sockets.somewhere.org/</code></p>
+
+ <p><code>wss://ws.example.com/stuff/</code></p>
+ </td>
+ <td>
+ <p><code>ftp://ftp.example.org/</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>ftps://ftp.example.org/</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>file:///a/</code><br>
+ (unmatched scheme)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>*://*.mozilla.org/*</code></p>
+
+ <p>Match all HTTP, HTTPS and WebSocket URLs that are hosted at "mozilla.org" or one of its subdomains.</p>
+ </td>
+ <td>
+ <p><code>http://mozilla.org/</code></p>
+
+ <p><code>https://mozilla.org/</code></p>
+
+ <p><code>http://a.mozilla.org/</code></p>
+
+ <p><code>http://a.b.mozilla.org/</code></p>
+
+ <p><code>https://b.mozilla.org/path/</code></p>
+
+ <p><code>ws://ws.mozilla.org/</code></p>
+
+ <p><code>wss://secure.mozilla.org/something</code></p>
+ </td>
+ <td>
+ <p><code>ftp://mozilla.org/</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>http://mozilla.com/</code><br>
+ (unmatched host)</p>
+
+ <p><code>http://firefox.org/</code><br>
+ (unmatched host)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>*://mozilla.org/</code></p>
+
+ <p>Match all HTTP, HTTPS and WebSocket URLs that are hosted at exactly "mozilla.org/".</p>
+ </td>
+ <td>
+ <p><code>http://mozilla.org/</code></p>
+
+ <p><code>https://mozilla.org/</code></p>
+
+ <p><code>ws://mozilla.org/</code></p>
+
+ <p><code>wss://mozilla.org/</code></p>
+ </td>
+ <td>
+ <p><code>ftp://mozilla.org/</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>http://a.mozilla.org/</code><br>
+ (unmatched host)</p>
+
+ <p><code>http://mozilla.org/a</code><br>
+ (unmatched path)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>ftp://mozilla.org/</code></p>
+
+ <p>Match only "ftp://mozilla.org/".</p>
+ </td>
+ <td><code>ftp://mozilla.org</code></td>
+ <td>
+ <p><code>http://mozilla.org/</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>ftp://sub.mozilla.org/</code><br>
+ (unmatched host)</p>
+
+ <p><code>ftp://mozilla.org/path</code><br>
+ (unmatched path)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>https://*/path</code></p>
+
+ <p>Match HTTPS URLs on any host, whose path is "path".</p>
+ </td>
+ <td>
+ <p><code>https://mozilla.org/path</code></p>
+
+ <p><code>https://a.mozilla.org/path</code></p>
+
+ <p><code>https://something.com/path</code></p>
+ </td>
+ <td>
+ <p><code>http://mozilla.org/path</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>https://mozilla.org/path/</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/a</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/path?foo=1</code><br>
+ (unmatched path due to URL query string)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>https://*/path/</code></p>
+
+ <p>Match HTTPS URLs on any host, whose path is "path/" and which has no URL query string.</p>
+ </td>
+ <td>
+ <p><code>https://mozilla.org/path/</code></p>
+
+ <p><code>https://a.mozilla.org/path/</code></p>
+
+ <p><code>https://something.com/path</code>/</p>
+ </td>
+ <td>
+ <p><code>http://mozilla.org/path/</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>https://mozilla.org/path</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/a</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/path/</code><code>?foo=1</code><br>
+ (unmatched path due to URL query string)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>https://mozilla.org/*</code></p>
+
+ <p>Match HTTPS URLs only at "mozilla.org", with any URL path and URL query string.</p>
+ </td>
+ <td>
+ <p><code>https://mozilla.org/</code></p>
+
+ <p><code>https://mozilla.org/path</code></p>
+
+ <p><code>https://mozilla.org/another</code></p>
+
+ <p><code>https://mozilla.org/path/to/doc</code></p>
+
+ <p><code>https://mozilla.org/path/to/doc?foo=1</code></p>
+ </td>
+ <td>
+ <p><code>http://mozilla.org/path</code><br>
+ (unmatched scheme)</p>
+
+ <p><code>https://mozilla.com/path</code><br>
+ (unmatched host)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>https://mozilla.org/a/b/c/</code></p>
+
+ <p>Match only this URL, or this URL with any URL fragment.</p>
+ </td>
+ <td>
+ <p><code>https://mozilla.org/a/b/c/</code></p>
+
+ <p><code>https://mozilla.org/a/b/c/#section1</code></p>
+ </td>
+ <td>Anything else.</td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>https://mozilla.org/*/b/*/</code></p>
+
+ <p>Match HTTPS URLs hosted on "mozilla.org", whose path contains a component "b" somewhere in the middle. Will match URLs with query strings, if the string ends in a <code>/</code>.</p>
+ </td>
+ <td>
+ <p><code>https://mozilla.org/a/b/c/</code></p>
+
+ <p><code>https://mozilla.org/d/b/f/</code></p>
+
+ <p><code>https://mozilla.org/a/b/c/d/</code></p>
+
+ <p><code>https://mozilla.org/a/b/c/d/#section1</code></p>
+
+ <p><code>https://mozilla.org/a/b/c/d/?foo=/</code></p>
+
+ <p><code>https://mozilla.org/a?foo=21314&amp;bar=/b/&amp;extra=c/</code></p>
+ </td>
+ <td>
+ <p><code>https://mozilla.org/b/*/</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/a/b/</code><br>
+ (unmatched path)</p>
+
+ <p><code>https://mozilla.org/a/b/c/d/?foo=bar</code><br>
+ (unmatched path due to URL query string)</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p><code>file:///blah/*</code></p>
+
+ <p>Match any FILE URL whose path begins with "blah".</p>
+ </td>
+ <td>
+ <p><code>file:///blah/</code></p>
+
+ <p><code>file:///blah/bleh</code></p>
+ </td>
+ <td><code>file:///bleh/</code><br>
+ (unmatched path)</td>
+ </tr>
+ </tbody>
+</table>
+
+<h3 id="Invalid_match_patterns">Invalid match patterns</h3>
+
+<table class="fullwidth-table standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Invalid pattern</th>
+ <th scope="col">Reason</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>resource://path/</code></td>
+ <td>Unsupported scheme.</td>
+ </tr>
+ <tr>
+ <td><code>https://mozilla.org</code></td>
+ <td>No path.</td>
+ </tr>
+ <tr>
+ <td><code>https://mozilla.*.org/</code></td>
+ <td>"*" in host must be at the start.</td>
+ </tr>
+ <tr>
+ <td><code>https://*zilla.org/</code></td>
+ <td>"*" in host must be the only character or be followed by ".".</td>
+ </tr>
+ <tr>
+ <td><code>http*://mozilla.org/</code></td>
+ <td>"*" in scheme must be the only character.</td>
+ </tr>
+ <tr>
+ <td><code>https://mozilla.org:80/</code></td>
+ <td>Host must not include a port number.</td>
+ </tr>
+ <tr>
+ <td><code>*://*</code></td>
+ <td>Empty path: this should be "<code>*://*/*</code>".</td>
+ </tr>
+ <tr>
+ <td><code>file://*</code></td>
+ <td>Empty path: this should be "<code>file:///*</code>".</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<h3 id="scheme_2">scheme</h3>
+
+
+
+<p>{{Compat("webextensions.match_patterns.scheme",10)}}</p>