diff options
Diffstat (limited to 'files/zh-tw/mozilla')
117 files changed, 13373 insertions, 0 deletions
diff --git a/files/zh-tw/mozilla/add-ons/add-on_debugger/index.html b/files/zh-tw/mozilla/add-ons/add-on_debugger/index.html new file mode 100644 index 0000000000..2b3106d6af --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/add-on_debugger/index.html @@ -0,0 +1,78 @@ +--- +title: 附加元件除錯工具箱 +slug: Mozilla/Add-ons/Add-on_Debugger +translation_of: 'https://extensionworkshop.com/documentation/develop/debugging/' +--- +<p>{{AddonSidebar}}</p> + +<p>附加元件除錯工具箱提供 Firefox 工具箱中的部分工具,能在附加元件的作用範圍中除錯:</p> + +<ul> + <li><a href="/en-US/docs/Tools/Debugger">JavaScript 除錯器</a>,可用以設定中斷點,或測試程式執行內部的各種狀態。</li> + <li><a href="/en-US/docs/Tools/Web_Console">主控台</a>,可用以查閱 log 訊息,或者在附加元件的作用範圍中執行 JavaScript</li> + <li><a href="/en-US/docs/Tools/Scratchpad">程式碼速記本</a>,可以在附加元件的作用範圍中執行 JavaScript,並另存為新檔</li> +</ul> + +<p>需要重新啟動瀏覽器的 XUL overlay 附加元件無法使用附加元件除錯工具箱,這類的元件請使用<a href="/en-US/docs/Tools/Browser_Toolbox">瀏覽器工具箱</a>。</p> + +<p>請看這段影片,快速認識附加元件除錯工具箱:</p> + +<p>{{EmbedYouTube("KU3Xsck7qy0")}}</p> + +<h2 id="啟用附加元件除錯工具箱" style="line-height: 30px; font-size: 2.14285714285714rem;">啟用附加元件除錯工具箱</h2> + +<div> +<p>如欲啟用附加元件除錯工具箱,您必須啟用 Firefox 裡的「啟用瀏覽器 chrome 與附加元件除錯工具箱」及「啟用遠端除錯」兩項設定。您可開啟<a href="https://developer.mozilla.org/en-US/docs/Tools/Tools_Toolbox">網頁工具箱</a>裡的<a href="https://developer.mozilla.org/en-US/docs/Tools/Tools_Toolbox#Settings">設定</a>,而後在「<a href="https://developer.mozilla.org/en-US/docs/Tools/Tools_Toolbox#Advanced_settings">進階設定</a>」一區中啟用上述選項。</p> +</div> + +<h2 id="開啟附加元件除錯工具箱"><span style="font-size: 2.14285714285714rem;">開啟</span>附加元件除錯工具箱</h2> + +<p><em>註:如前所述,附加元件除錯工具</em>箱<em>是專供不需重新啟動、以 SDK 製作的附加元件使用。若想為其他類型的附加元件除錯,請使用<span style="line-height: 1.5;"><a href="https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox">瀏覽器工具箱</a>裡的工具。</span></em></p> + +<p><span style="line-height: 1.5;">Now open the Add-on Manager. Next to the entry for your add-on you will see a button labeled "Debug". Click this button to launch the debugger.</span></p> + +<p>Next you'll see a dialog asking you to accept an incoming connection. Click "OK", and the debugger will start in a separate window. Note that sometimes the debugger window is hidden by the main Firefox window.</p> + +<p>{{EmbedYouTube("DvNpUVJcG_E")}}</p> + +<h2 id="使用附加元件除錯工具">使用附加元件除錯工具</h2> + +<p>The Add-on Debugger looks and behaves very much like the <a href="/en-US/docs/Tools/Browser_Toolbox">Browser Toolbox</a>, except that while the scope of the Browser Toolbox is the whole browser, the Add-on Debugger is focused on the specific add-on for which you launched it. Like the Browser Toolbox, a toolbar along the top lets you switch between a number of different tools. In Firefox 31 there's only one such tool, the JavaScript Debugger, but with Firefox 32 you also get the Console and Scratchpad.</p> + +<h3 id="JavaScript_除錯器">JavaScript 除錯器</h3> + +<p>This behaves just like the normal <a href="/en-US/docs/Tools/Debugger">JavaScript Debugger</a>, except its scope is the add-on rather than a web page. On the left-hand side it lists JavaScript sources:</p> + +<ul> + <li>at the top is <code>bootstrap.js</code>: either the one you've written if your add-on is a manually written <a href="/en-US/Add-ons/Bootstrapped_extensions">bootstrapped add-on</a>, or the one included by the SDK if your add-on is an SDK add-on.</li> + <li>next, if your add-on is an SDK add-on, you'll find your add-on's <code>main.js</code>, any <a href="/en-US/Add-ons/SDK/Guides/Module_structure_of_the_SDK#Local_Modules">local modules</a> shipping with your add-on, and any content scripts that are currently loaded</li> + <li>next, all the SDK modules used directly or indirectly by your add-on</li> +</ul> + +<h4 id="Content_scripts">Content scripts</h4> + +<p>Content scripts are only listed if and when they are loaded. So, if your Add-on <a href="/en-US/Add-ons/SDK/Guides/Content_Scripts#Loading_content_scripts">loads a content script</a> with <code>contentScriptFile</code>, the file will not appear in the debugger sources until you go to a page that loads the content script.</p> + +<p>If you set a breakpoint in a content script, it will not be active for instances of the content script which are loaded after the breakpoint is set.</p> + +<p>For example, suppose you have an add-on that attaches a content script to every tab the user loads. The content script adds a click handler to the page. As soon as you open a tab, this content script will be listed in the debugger. If you then set a breakpoint in the content script's click handler, then execution will pause whenever you click the page. But if you open a new tab, there are now two instances of the content script, and the breakpoint will not be enabled for the second instance You'll need to set a new breakpoint now if you want to it work for the second instance.</p> + +<p>We're investigating improvements to this in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1016046">bug 1016046</a>.</p> + +<h3 id="主控台">主控台</h3> + +<p>The Console behaves just like the <a href="/en-US/docs/Tools/Web_Console">Web Console</a>, but its scope is the add-on rather than the web page.</p> + +<p>However, note that it actually runs in the context of the add-on's <code>bootstrap.js</code>, which may not be what you expect if your add-on uses the SDK: you won't see any objects defined in your add-on's <code>main.js</code>, and you won't see <code>require()</code> either. This issue is being tracked as <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1005193">bug 1005193</a>.</p> + +<p>You can execute Console statements in the context of <code>main.js</code> while execution is paused inside <code>main.js</code>.</p> + +<h3 id="程式碼速記本">程式碼速記本</h3> + +<p>The Scratchpad behaves just like the normal <a href="/en-US/docs/Tools/Scratchpad">Scratchpad</a>, but its scope is the add-on rather than the web page.</p> + +<p>Like the Console, the add-on Scratchpad runs in the context of the add-on's <code>bootstrap.js</code> even if the add-on uses the SDK, and as with the Console you can execute Scratchpad code in the context of <code>main.js</code> while execution is paused inside <code>main.js</code>.</p> + +<h2 id="為_chrome_或_about_頁面除錯">為 chrome: 或 about: 頁面除錯</h2> + +<p>從 Firefox 37 起,一般的<a href="/en-US/docs/Tools/Debugger">除錯工具</a>已經可以用來為 chrome: 及 about: 兩類頁面除錯,使用方法同一般網頁除錯。</p> diff --git a/files/zh-tw/mozilla/add-ons/add-on_guidelines/index.html b/files/zh-tw/mozilla/add-ons/add-on_guidelines/index.html new file mode 100644 index 0000000000..fe05866a87 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/add-on_guidelines/index.html @@ -0,0 +1,117 @@ +--- +title: Add-on guidelines +slug: Mozilla/Add-ons/Add-on_guidelines +translation_of: 'https://extensionworkshop.com/documentation/publish/add-on-policies/' +--- +<p>These add-on guidelines were created to foster an open and diverse add-on developer community while ensuring an excellent user experience. They apply to all add-ons and add-on updates regardless of where they are hosted, and also apply to customizations performed by installers that configure Firefox without using an add-on. Add-ons hosted on <a class="external text" href="https://addons.mozilla.org/" rel="nofollow">AMO</a> are subject to <a href="https://addons.mozilla.org/developers/docs/policies" title="https://addons.mozilla.org/developers/docs/policies">additional policies</a>.</p> +<h2 id="Be_Transparent">Be Transparent</h2> +<ul> + <li>Add-ons must either be installed using the add-on web install system, or be approved by the user using the <a class="external text" href="https://blog.mozilla.org/addons/2011/08/11/strengthening-user-control-of-add-ons/" rel="nofollow">install opt-in dialog</a>. + <ul> + <li>We want our users to know what they are installing so that they are not unpleasantly surprised by changes they did not expect. We also want them to know what to remove if they decide not to keep it.</li> + <li>Add-ons installed through application installers should <a class="external text" href="/en-US/docs/Adding_Extensions_using_the_Windows_Registry" rel="nofollow">use the Windows Registry</a> or equivalent global install methods so that Firefox displays the opt-in screen. The opt-in screen must not be tampered with in any way, including overlaying additional information or images on top of it.</li> + </ul> + </li> + <li>Add-ons must always be possible to uninstall or disable from the Add-ons Manager. + <ul> + <li>Add-ons installed globally using the Windows registry or global extension directories cannot be uninstalled (<a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=640775" rel="nofollow">bug 640775</a>), but they can be disabled to the same effect.</li> + </ul> + </li> + <li>Add-ons must use a <a class="external text" href="/en-US/docs/Install_manifests#id" rel="nofollow">single unique ID</a> during their entire lifetime. + <ul> + <li>Using the same ID for multiple products, or multiple IDs for a single product, can lead to problems with automatic updates as well as blocklisting conflicts. Add-ons may change their IDs due to ownership changes, as they commonly use an email address-like format ( + <i> + e.g.,</i> + personasplus@mozilla.com).</li> + </ul> + </li> + <li>Add-ons must not use brand names, trademarks, or other terms in ways that deceive users. Using Mozilla trademarks must follow <a class="external text" href="http://www.mozilla.org/foundation/trademarks/policy.html" rel="nofollow">our trademark policy</a>.</li> + <li>Add-ons should clearly communicate their intended purpose and active features, including features introduced through updates. + <ul> + <li>While we understand and support add-on developers who choose to monetize their products, this should not come at the expense of users' browsing experience. If an add-on inserts advertisements, affiliate codes, sponsored search results, or the like, into web pages, the user should be made aware of this when the add-on is installed. Likewise, if some features require payment to use, or require payment to remain active after a trial period, users should be made aware of this.</li> + </ul> + </li> +</ul> +<h2 id="Be_Respectful_to_Users">Be Respectful to Users</h2> +<ul> + <li>Add-ons must remove all introduced code, executables, and application configuration changes when they are uninstalled. + <ul> + <li>Uninstalling an add-on using the regular uninstall process should generally suffice. This guideline primarily applies to changes made to preferences such as the homepage, default search URL, network settings, and so forth. These preferences should be restored to their previous values when the add-on is uninstalled. Most add-ons can easily accomplish this by making such changes via a <a class="external text" href="/en-US/docs/Building_an_Extension#Defaults_Files" rel="nofollow">default preferences file</a>.</li> + </ul> + </li> + <li>Add-ons must respect the users' choices and not make unexpected changes, or limit users' ability to revert them. + <ul> + <li>For instance, users generally do not expect an add-on to change the Firefox homepage. Asking users to opt-in to such extra changes is recommended.</li> + <li>Making settings changes difficult or impossible to revert is prohibited. It's not allowed to block users or other add-ons or installers from changing any settings.</li> + </ul> + </li> + <li>Add-ons should make it clear how private user data is being used. + <ul> + <li>Add-ons which send user data over the Internet should generally provide a Privacy Policy, ideally concise and easily readable.</li> + </ul> + </li> + <li>Add-on developers should provide a mechanism for them to be contacted. + <ul> + <li>While developers are not required to provide a support channel for users, it is recommended. All add-on developers should have a contact form or public email address so that they can be contacted in case of emergencies, such as guideline violations that could lead to blocklisting.</li> + </ul> + </li> +</ul> +<h2 id="Be_Safe">Be Safe</h2> +<ul> + <li>Add-ons must not cause harm to users' data, system, or online identities.</li> + <li>Add-ons must not transmit users' private data unsafely, or expose it to third parties unnecessarily. + <ul> + <li>Private data should always be sent over a secure connection. This includes browsing data such as visited URLs and bookmarks.</li> + <li>Making the browser easier to fingerprint by adding text to the User-Agent string or adding custom headers is also a privacy concern, and should be avoided.</li> + </ul> + </li> + <li>Add-ons must not create or expose application or system vulnerabilities. + <ul> + <li>Security bugs happen, but once discovered they need to be addressed immediately. A popular add-on with a security vulnerability is a valuable attack vector for hackers, and in such cases we will move quickly to blocklist the add-on if there is no prompt response from the developer.</li> + </ul> + </li> + <li>Add-ons must not tamper with the application or blocklist update systems.</li> + <li>Add-ons should not store any browsing data while in Private Browsing Mode. + <ul> + <li>It's worth stressing that PBM is about avoiding storing + <i> + local</i> + data while browsing, not about sending data elsewhere. To learn more about PBM we recommend reading <a class="external text" href="http://ehsanakhgari.org/tag/privatebrowsing" rel="nofollow">Ehsan's blog posts</a> about it.</li> + </ul> + </li> +</ul> +<h2 id="Be_Stable">Be Stable</h2> +<ul> + <li>Add-ons must not cause hangs or crashes.</li> + <li>Add-ons should not break or disable core application features. + <ul> + <li>This includes features like tabbed browsing, Private Browsing Mode, and the location bar. Add-ons that are specifically meant to do this are exempt.</li> + </ul> + </li> + <li>Add-ons should not cause memory leaks, or unnecessarily consume large amounts of memory.</li> + <li>Add-ons should not slow down the application or system significantly.</li> + <li>Add-ons should not consume network resources to an extent that affects regular application usage. + <ul> + <li>Downloading large amounts of data without user awareness can significantly disrupt regular browsing, and may result in unexpected charges for users who have network usage limitations (notably on mobile).</li> + </ul> + </li> +</ul> +<h2 id="Exceptions">Exceptions</h2> +<ul> + <li>Add-ons can break some of these guidelines if that's their intended purpose and there isn't malicious intent ( + <i> + e.g.,</i> + a security exploit proof of concept).</li> + <li>Add-ons deployed by administrators within workplaces, schools, kiosks, and so forth, are exempt from most guidelines.</li> + <li>As add-ons can only run clean up code if they are uninstalled while Firefox is running and they are enabled, we do not require that they attempt to clean up after themselves when they are uninstalled under other circumstances. Application installers that configure Firefox without add-ons should revert any changes when uninstalled.</li> + <li>Add-ons may leave behind preferences changes in private preference branches which do not affect Firefox when the add-on is not active, so that any previous add-on configuration is not lost if the user decides to re-install the add-on in the future.</li> +</ul> +<p>Other exceptions may apply.</p> +<h2 id="Enforcement">Enforcement</h2> +<p>Add-ons that do not follow these guidelines may qualify for blocklisting, depending on the extent of the violations. Guidelines qualified with the word + <i> + must</i> + are especially important, and violations thereof will most likely result in a blocklisting nomination.</p> +<p>The Add-ons Team will do their best to contact the add-on's developers and provide a reasonable time frame for the problems to be corrected before a block is put in place. If an add-on is considered malicious or its developers have proven unreachable or unresponsive, or in case of repeat violations, blocklisting may be immediate.</p> +<p>Guideline violations should be <a class="external text" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Tech%20Evangelism&component=Add-ons" rel="nofollow">reported via Bugzilla</a>, under Tech Evangelism > Add-ons. Questions can be posted in the <a class="external text" href="irc://irc.mozilla.org/addons" rel="nofollow">#addons IRC channel</a>.</p> +<p>These guidelines may change in the future. All updates will be announced in the <a class="external text" href="https://blog.mozilla.org/addons/" rel="nofollow">Add-ons Blog</a>.</p> diff --git a/files/zh-tw/mozilla/add-ons/amo/index.html b/files/zh-tw/mozilla/add-ons/amo/index.html new file mode 100644 index 0000000000..3857ed65ca --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/amo/index.html @@ -0,0 +1,9 @@ +--- +title: AMO +slug: Mozilla/Add-ons/AMO +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/AMO +--- +<p>Content to be added.</p> diff --git a/files/zh-tw/mozilla/add-ons/amo/policy/index.html b/files/zh-tw/mozilla/add-ons/amo/policy/index.html new file mode 100644 index 0000000000..8ac1738387 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/amo/policy/index.html @@ -0,0 +1,21 @@ +--- +title: AMO 政策 +slug: Mozilla/Add-ons/AMO/Policy +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/AMO/Policy +--- +<p>{{AddonSidebar}}</p> + +<p>Mozilla 致力於確保套件的用戶與開發者,都有著良好的體驗。提交套件以前,請閱讀以下政策。</p> + +<dl> + <dd></dd><dt><a href="/Mozilla/Add-ons/AMO/Policy/Agreement">Developer Agreement</a></dt> +<dd>Effective January 5, 2016</dd> <dt><a href="/Mozilla/Add-ons/AMO/Policy/Reviews">Review Process</a></dt> +<dd>Add-ons extend the core capabilities of Firefox, allowing users to modify and personalize their Web experience. A healthy add-on ecosystem, built on trust, is vital for developers to be successful and users to feel safe making Firefox their own. For these reasons, Mozilla requires all add-ons to comply with the following set of policies on acceptable practices. The below is not intended to serve as legal advice, nor is it intended to serve as a comprehensive list of terms to include in your add-on’s privacy policy.</dd> <dt><a href="/Mozilla/Add-ons/AMO/Policy/Featured">Featured Add-ons</a></dt> +<dd>How up-and-coming add-ons become featured and what's involved in the process. </dd> <strong><a href="/zh-TW/Add-ons#Contact_us">聯絡我們</a></strong> + + <p>如何就這些套件的政策,與我們取得聯繫</p> + +</dl> diff --git a/files/zh-tw/mozilla/add-ons/amo/policy/聯絡資訊/index.html b/files/zh-tw/mozilla/add-ons/amo/policy/聯絡資訊/index.html new file mode 100644 index 0000000000..7358e5f642 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/amo/policy/聯絡資訊/index.html @@ -0,0 +1,24 @@ +--- +title: 附加元件聯絡資訊 +slug: Mozilla/Add-ons/AMO/Policy/聯絡資訊 +translation_of: Mozilla/Add-ons#Contact_us +--- +<p>誠摯的感謝您連絡 Mozilla 附加元件團隊,淺請先閱讀本頁說明以確保您的訊息被正確的遞送。</p> + +<h4 id="附加元件支援服務">附加元件支援服務</h4> + +<p>若你需要特定附加元件的支援訊息,比如說 "我該如何使用這個附加元件?" 或 "它怎麼不能...?",請透過列於附加元建列表中的聯絡方式,聯絡該附加元件的開發者。</p> + +<h4 id="附加元件編輯者審閱">附加元件編輯者審閱</h4> + +<p>若你有任何關於某個附加元件的編輯者審閱(Editor's review)的疑問,或想回報政策違反,請 E-mail 至 <a href="mailto:amo-editors@mozilla.org">amo-editors@mozilla.org</a>。<strong>Almost all add-on reports fall under this category.</strong> Please be sure to include a link to the add-on in question and a detailed description of your question or comment.</p> + +<h4 id="Add-on_Security_Vulnerabilities">Add-on Security Vulnerabilities</h4> + +<p>If you have discovered a security vulnerability in an add-on, even if it is not hosted here, Mozilla is very interested in your discovery and will work with the add-on developer to correct the issue as soon as possible. Add-on security issues can be reported <a href="http://www.mozilla.org/projects/security/security-bugs-policy.html">confidentially</a> in <a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=addons.mozilla.org&component=Add-on%20Security&maketemplate=Add-on%20Security%20Bug&bit-23=1&rep_platform=All&op_sys=All">Bugzilla</a> or by emailing <a href="mailto:amo-admins@mozilla.org">amo-admins@mozilla.org</a>.</p> + +<h4 id="Website_Functionality_Development">Website Functionality & Development</h4> + +<p>If you've found a problem with the site, we'd love to fix it. Please <a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=addons.mozilla.org">file a bug report</a> in Bugzilla, including the location of the problem and how you encountered it.</p> + +<p><span class="comment seoSummary">How to get in touch with us regarding these policies or your add-on. </span></p> diff --git a/files/zh-tw/mozilla/add-ons/firefox_for_android/api/index.html b/files/zh-tw/mozilla/add-ons/firefox_for_android/api/index.html new file mode 100644 index 0000000000..a8e6ebf9e0 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/firefox_for_android/api/index.html @@ -0,0 +1,30 @@ +--- +title: API +slug: Mozilla/Add-ons/Firefox_for_Android/API +tags: + - NeedsTranslation + - TopicStub +translation_of: Archive/Add-ons/Legacy_Firefox_for_Android/API +--- +<p>There are a couple of differences between desktop Firefox and Firefox for Android that are particularly relevant to add-on developers:</p> + +<ul> + <li>there is no visible XUL in the user interface, so you can't use XUL overlays to create your add-on's UI</li> + <li>the <a href="https://developer.mozilla.org/en-US/docs/Code_snippets/Tabbed_browser" title="https://developer.mozilla.org/en-US/docs/Code_snippets/Tabbed_browser"><code>gBrowser</code></a> object does not exist, so you can't use <a href="https://developer.mozilla.org/en-US/docs/XUL/tabbrowser" title="https://developer.mozilla.org/en-US/docs/XUL/tabbrowser"><code>tabbrowser</code></a> to interact with browser tabs</li> +</ul> + +<p>Instead, Firefox for Android provides its own APIs:</p> + +<ul> + <li><a href="/en-US/docs/Extensions/Mobile/API/NativeWindow" title="/en-US/docs/DOM/en/Extensions/Mobile/API/NativeWindow"><code>NativeWindow</code></a> enables you to manipulate parts of the native Android UI</li> + <li><a href="/en-US/docs/Extensions/Mobile/API/BrowserApp" title="/en-US/docs/Extensions/Mobile/API/BrowserApp"><code>BrowserApp</code></a> enables you to interact with browser tabs</li> + <li><a href="/en-US/Add-ons/Firefox_for_Android/API/PageActions.jsm">PageActions.jsm</a> allows you to add buttons to the urlbar. {{fx_minversion_inline("34")}}</li> + <li><a href="/en-US/docs/Extensions/Mobile/API/Prompt.jsm" title="/en-US/docs/Extensions/Mobile/API/Prompt.jsm"><code>Prompt.jsm</code></a> allows you to easily show native prompts, dialogs, menus, and lists</li> + <li><a href="/en-US/docs/Extensions/Mobile/API/Notifications.jsm"><code>Notifications.jsm</code></a> allows you to handle system notifcations</li> + <li><a href="/en-US/docs/Extensions/Mobile/API/Home.jsm" title="/en-US/docs/Extensions/Mobile/API/Prompt.jsm"><code>Home.jsm</code></a> allows you to customize the home page</li> + <li><a href="/en-US/Add-ons/Firefox_for_Android/API/HomeProvider.jsm" title="/en-US/docs/Extensions/Mobile/API/Prompt.jsm"><code>HomeProvider.jsm</code></a> allows you to store data to show on the home page</li> + <li><a href="/en-US/Add-ons/Firefox_for_Android/API/Accounts.jsm" title="/en-US/docs/Extensions/Mobile/API/Prompt.jsm"><code>Accounts.jsm</code></a> allows you to start the Firefox Account set-up process</li> + <li><a href="/en-US/Add-ons/Firefox_for_Android/API/JavaAddonManager.jsm" title="/en-US/docs/Extensions/Mobile/API/Prompt.jsm"><code>JavaAddonManager.jsm</code></a> allows you to dynamically load and interface with compiled Java code. {{fx_minversion_inline("42")}}</li> +</ul> + +<p>In these pages we've documented the main functions and properties exposed by these objects. To see all the details, refer to the code at <a class="external" href="http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js" title="http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js"><code>browser.js</code></a>.</p> diff --git a/files/zh-tw/mozilla/add-ons/firefox_for_android/index.html b/files/zh-tw/mozilla/add-ons/firefox_for_android/index.html new file mode 100644 index 0000000000..8ade48ff37 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/firefox_for_android/index.html @@ -0,0 +1,70 @@ +--- +title: Extensions for Firefox for Android +slug: Mozilla/Add-ons/Firefox_for_Android +tags: + - NeedsTranslation + - TopicStub +translation_of: Archive/Add-ons/Legacy_Firefox_for_Android +--- +<p>Firefox for Android supports add-ons using the same <a href="/en-US/Add-ons" title="en/Extensions">extension system</a> used by all other Gecko-based applications. You can use the <a href="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/mobile.html">Add-on SDK</a> or build <a href="/en-US/Add-ons/Bootstrapped_extensions">manually bootstrapped restartless add-ons</a>. You can even develop traditional restart-required add-ons, although the other two approaches are preferable.</p> + +<p>Add-ons that work with desktop Firefox <strong>do not</strong> automatically work in Firefox for Android:</p> + +<ul> + <li>There is no visible XUL in the UI, so you can't use an overlay to create the UI.</li> + <li>Internal code and objects, like <code>gBrowser</code>, do not exist. Look at the Firefox on Android <a class="external" href="http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js" title="http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js"><code>browser.js</code></a> file to learn about the internals. Much of the same fundamental functionality exists.</li> + <li>Services like <code>nsIPromptService</code> and <code>nsIAlertsService</code> are implemented to use native Android UI.</li> + <li>There is a simple JavaScript object, called <a href="https://developer.mozilla.org/en/Extensions/Mobile/API/NativeWindow" title="en/Extensions/Mobile/NativeWindow"><code>NativeWindow</code></a>, that allows you to manipulate parts of the native Android UI.</li> +</ul> + +<p>The following articles provide help with developing extensions for Firefox on Android. In addition, please refer to the <a class="internal" href="/en-US/Add-ons" title="En/Extensions">general extension documentation</a> that applies to all Mozilla applications.</p> + +<div class="column-container"> +<div class="column-half"> +<h3 id="Tutorials">Tutorials</h3> + +<dl> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/Walkthrough">Walkthrough</a></dt> + <dd>Developing, packaging and installing a simple add-on for Firefox for Android.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/Firefox_Hub_Walkthrough">Firefox Hub Walkthrough</a></dt> + <dd>How to develop a Firefox Hub add-on to add content to the Firefox for Android home page.</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials/Mobile_development">Add-on SDK</a></dt> + <dd>How to develop Firefox for Android add-ons using the Add-on SDK.</dd> +</dl> + +<h3 id="Sample_code">Sample code</h3> + +<dl> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/Code_snippets">Code Snippets</a></dt> + <dd>Code samples for common tasks.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/Initialization_and_Cleanup">Initialization and Cleanup</a></dt> + <dd>How to initialize your add-on when it is started and clean up when it is shut down.</dd> + <dt><a href="https://github.com/mozilla/firefox-for-android-addons">Firefox for Android Add-ons Github Repo</a></dt> + <dd>A collection of JS modules, sample code, and boilerplate repos to help you build add-ons for Firefox for Android.</dd> +</dl> +</div> + +<div class="column-half"> +<h3 id="API_reference">API reference</h3> + +<dl> + <dt><a class="internal" href="/en-US/Add-ons/Firefox_for_Android/API/NativeWindow">NativeWindow</a></dt> + <dd>Create native Android UI widgets.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/API/BrowserApp">BrowserApp</a></dt> + <dd>Access browser tabs and the web content they host.</dd> + <dt><a class="internal" href="/en-US/Add-ons/Firefox_for_Android/API/Prompt.jsm">Prompt.jsm</a></dt> + <dd>Show native Android dialogs.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/API/HelperApps.jsm">HelperApps.jsm</a></dt> + <dd>Query and launch native apps installed on the system.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/API/Notifications.jsm">Notifications.jsm</a></dt> + <dd>Use extended properties for Android system notifications.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/API/Home.jsm">Home.jsm</a></dt> + <dd>Customize the home page.</dd> + <dt><a href="/en-US/Add-ons/Firefox_for_Android/API/HomeProvider.jsm">HomeProvider.jsm</a></dt> + <dd>Store data to display on the home page.</dd> + <dt> </dt> +</dl> +</div> +</div> + +<p> </p> diff --git a/files/zh-tw/mozilla/add-ons/index.html b/files/zh-tw/mozilla/add-ons/index.html new file mode 100644 index 0000000000..6d2945ed44 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/index.html @@ -0,0 +1,89 @@ +--- +title: 附加元件 +slug: Mozilla/Add-ons +translation_of: Mozilla/Add-ons +--- +<div>{{AddonSidebar}}</div> + +<p><span class="seoSummary">附加元件允許開發者擴充並訂製 Firefox 的功能。</span>它們使用標準的 Web 技術--JavaScript、HTML、CSS、還有一些專門的 JavaScript API--寫成。另外,附加元件還能:</p> + +<ul> + <li>更改特定網站的外觀與內容</li> + <li>訂製 Firefox 用戶介面</li> + <li>增加 Firefox 的新功能</li> +</ul> + +<h2 id="開發附加元件">開發附加元件</h2> + +<p>目前有許多開發 Firefox 附加元件的工具,但 <a href="/zh-TW/Add-ons/WebExtensions">WebExtensions</a> 會在 2017 年末成為標準。其他的工具如傳統附加元件、免重啟附加元件、附加元件 SDK 等,屆時皆預期棄用。</p> + +<p><a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions" style="margin-left: auto; margin-right: auto; margin-bottom: 20px; padding: 10px; text-align: center; border-radius: 4px; display: block; width: 30%; background-color: #81BC2E; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">深入理解 WebExtensions</a></p> + +<p>如果要寫新的附加元件,推薦使用 WebExtension 撰寫。</p> + +<p>WebExtensions 是被設計為跨瀏覽器通用的:為 Firefox 撰寫的 WebExtensions 通常只要在一點點的改變下,就能在 Chrome、Edge、Opera 運行。它們也能與多行程 Firefox 完全相容。</p> + +<p><a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs">請參見目前在 Firefox 和其他瀏覽器所支援的 API</a>。我們正持續設計與導入新的 API,以回應開發者所需。</p> + +<p>多數 WebExtensions API 也能在 Firefox for Android 運行。</p> + +<h2 id="與現有附加元件合併">與現有附加元件合併</h2> + +<p>如果你正在維護過時的附加元件如 XUL overlay、bootstrapped、附加元件 SDK 等,我們建議把它移植到 WebExtension。MDN 有一些<a href="/zh-TW/Add-ons/WebExtensions/Porting_a_legacy_Firefox_add-on">移植指引</a>。</p> + +<p>我們在 wiki page 上收集了一些<a href="https://wiki.mozilla.org/Add-ons/developer/communication">資源</a>以助開發者完成移植。要開始的話,請使用 <a href="https://compatibility-lookup.services.mozilla.com/">Lookup Tool</a> 來檢查你的附加元件有無受影響。</p> + +<h2 id="發佈附加元件">發佈附加元件</h2> + +<p><a href="https://addons.mozilla.org">Addons.mozilla.org</a>,也俗稱「AMO」,是 Mozilla 給開發者們陳列附加元件的官方網站,用戶們也可以在那邊找到所需。當你把附加元件上傳到 AMO 時,你可以參與我們的用戶和創作者社區、並找到你附加元件的擁躉們。</p> + +<p>你不用把附加元件上傳到 AMO,但你的附加元件需要給 Mozilla 簽署。否則,用戶將無法安裝。</p> + +<p>要找到發佈附加元件的過程概觀,請參見<a href="https://developer.mozilla.org/zh-TW/Add-ons/Distribution">簽署並發布你的附加元件</a>。</p> + +<h2 id="其他種類的附加元件">其他種類的附加元件</h2> + +<p>通常,當大家在講「附加元件」時候,他們是指套件(extension)。但也有其他類型的附加元件,允許用戶訂製 Firefox。包含:</p> + +<ul> + <li><a href="https://developer.mozilla.org/Add-ons/Themes/Background">Lightweight themes</a> 提供簡單而有限的方法自訂 Firefox。</li> + <li><a href="/zh-TW/Add-ons/Firefox_for_Android">Mobile add-ons</a> 是給 Firefox for Android 的附加元件。注意,我們打算棄用這些 API:未來,WebExtensions 會在 Firefox for Android 完全支持。</li> + <li><a href="/zh-TW/docs/Creating_OpenSearch_plugins_for_Firefox">搜尋引擎套件</a>會在瀏覽器的搜尋欄位增加新的搜尋引擎。</li> + <li><a href="/zh-TW/docs/Mozilla/Creating_a_spell_check_dictionary_add-on">用戶字典</a>能讓你在不同語言內檢查拼字。</li> + <li><a href="https://support.mozilla.org/kb/use-firefox-interface-other-languages-language-pack">語言包</a>能讓你的 Firefox 用戶介面支援多語言。</li> +</ul> + +<hr> +<h2 id="聯絡我們">聯絡我們</h2> + +<p>你可以透過以下連結取得協助、獲取附加元件的新聞、還有得到回饋。</p> + +<h3 id="附加元件論壇">附加元件論壇</h3> + +<p>使用<a href="https://discourse.mozilla-community.org/c/add-ons">附加元件討論論壇</a>討論附加元件方面的開發並取得協助。</p> + +<h3 id="電郵群組">電郵群組</h3> + +<p>請使用 <strong>dev-addons</strong> 群組討論附加元件開發生態圈,包含 WebExtension 系統開發與 AMO:</p> + +<ul> + <li><a href="https://mail.mozilla.org/listinfo/dev-addons">dev-addons list info</a></li> + <li><a href="https://mail.mozilla.org/pipermail/dev-addons/">dev-addons archives</a></li> +</ul> + +<p>請使用 <strong>webextensions-support</strong> list 以取得移植到 WebExtension 的協助:</p> + +<ul> + <li><a href="https://mail.mozilla.org/listinfo/webextensions-support">webextensions-support list info</a></li> + <li><a href="https://mail.mozilla.org/private/webextensions-support/">webextensions-support archives</a></li> +</ul> + +<h3 id="IRC">IRC</h3> + +<p>如果你喜歡用 IRC,你可以在這裡聯繫:</p> + +<ul> + <li><a href="irc://irc.mozilla.org/addons">#addons</a>(討論附加元件生態圈)</li> + <li><a href="irc://irc.mozilla.org/extdev">#extdev</a>(附加元件開發的一般交流)</li> + <li><a href="irc://irc.mozilla.org/webextensions">#webextensions</a> (專門討論 WebExtensions)</li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/sdk/builder/index.html b/files/zh-tw/mozilla/add-ons/sdk/builder/index.html new file mode 100644 index 0000000000..f7dc93a009 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/sdk/builder/index.html @@ -0,0 +1,13 @@ +--- +title: Builder +slug: Mozilla/Add-ons/SDK/Builder +translation_of: Archive/Add-ons/Add-on_SDK/Builder +--- +<p>Add-on Builder 是 Web-based 的開發環境,讓開發者能以 SDK API 來開發附加元件,而不必使用 <code>cfx</code> 命令列工具。Add-on Builder 已經於 2014 年 4 月 1 日下架,而原本的網址「builder.addons.mozilla.org」則轉至此頁。<br> + <br> + 若您過去使用 Builder 來開發採用 SDK 的附加元件,便已獲得絕大部分以 SDK 直接開發的必備知識。Builder 中的 <a href="/Mozilla/Add-ons/SDK/High-Level_APIs">high-level</a> 與 <a href="/Mozilla/Add-ons/SDK/Low-Level_APIs">low-level</a> API,就跟 SDK 裡的一模一樣。改用 SDK 很簡單:</p> +<ul> + <li><a href="/Mozilla/Add-ons/SDK/Tutorials/Installation">首先在您的電腦上安裝 SDK</a></li> + <li>閱讀<a href="/Mozilla/Add-ons/SDK/Tutorials/Getting_started">入門文件</a>與 <a href="/Mozilla/Add-ons/SDK/Tools/cfx"><code>cfx</code> 參考文件</a>,學習使用 cfx 命令列工具</li> + <li>深入了解 <a href="/Mozilla/Add-ons/SDK/Tools/package_json">package.json</a> 檔,以便設定附加原件的屬性</li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/sdk/guides/index.html b/files/zh-tw/mozilla/add-ons/sdk/guides/index.html new file mode 100644 index 0000000000..f4e37d9e10 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/sdk/guides/index.html @@ -0,0 +1,115 @@ +--- +title: Guides +slug: Mozilla/Add-ons/SDK/Guides +translation_of: Archive/Add-ons/Add-on_SDK/Guides +--- +<p>This page lists more theoretical in-depth articles about the SDK.</p> +<hr> +<h3 id="Contributor's_guide"><a name="contributors-guide">Contributor's guide</a></h3> +<div class="column-container"> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Getting_Started">Getting Started</a></dt> + <dd> + Learn how to contribute to the SDK: getting the code, opening/taking a bug, filing a patch, getting reviews, and getting help.</dd> + <dt> + <a href="Guides/Modules">Modules</a></dt> + <dd> + Learn about the module system used by the SDK (which is based on the CommonJS specification), how sandboxes and compartments can be used to improve security, and about the built-in SDK module loader, known as Cuddlefish.</dd> + <dt> + <a href="Guides/Classes_and_Inheritance">Classes and Inheritance</a></dt> + <dd> + Learn how classes and inheritance can be implemented in JavaScript, using constructors and prototypes, and about the helper functions provided by the SDK to simplify this.</dd> + </dl> + </div> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Private_Properties">Private Properties</a></dt> + <dd> + Learn how private properties can be implemented in JavaScript using prefixes, closures, and WeakMaps, and how the SDK supports private properties by using namespaces (which are a generalization of WeakMaps).</dd> + <dt> + <a href="Guides/Content_Processes">Content Processes</a></dt> + <dd> + The SDK was designed to work in an environment where the code to manipulate web content runs in a different process from the main add-on code. This article highlights the main features of that design.</dd> + </dl> + </div> +</div> +<hr> +<h3 id="SDK_infrastructure"><a name="sdk-infrastructure">SDK infrastructure</a></h3> +<div class="column-container"> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Module_structure_of_the_SDK">Module structure of the SDK</a></dt> + <dd> + The SDK, and add-ons built using it, are of composed from reusable JavaScript modules. This explains what these modules are, how to load modules, and how the SDK's module tree is structured.</dd> + <dt> + <a href="Guides/SDK_API_Lifecycle">SDK API lifecycle</a></dt> + <dd> + Definition of the lifecycle for the SDK's APIs, including the stability ratings for APIs.</dd> + </dl> + </div> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Program_ID">Program ID</a></dt> + <dd> + The Program ID is a unique identifier for your add-on. This guide explains how it's created, what it's used for and how to define your own.</dd> + <dt> + <a href="Guides/Firefox_Compatibility">Firefox compatibility</a></dt> + <dd> + Working out which Firefox releases a given SDK release is compatible with, and dealing with compatibility problems.</dd> + </dl> + </div> +</div> +<hr> +<h3 id="SDK_idioms"><a name="sdk-idioms">SDK idioms</a></h3> +<div class="column-container"> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Working_with_Events">Working With Events</a></dt> + <dd> + Write event-driven code using the the SDK's event emitting framework.</dd> + <dt> + <a href="Guides/Content_Scripts">Content scripts guide</a></dt> + <dd> + An overview of content scripts, including: what they are, what they can do, how to load them, how to communicate with them.</dd> + </dl> + </div> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Two_Types_of_Scripts">Two Types of Scripts</a></dt> + <dd> + This article explains the differences between the APIs available to your main add-on code and those available to content scripts.</dd> + </dl> + </div> +</div> +<hr> +<h3 id="XUL_migration"><a name="xul-migration">XUL migration</a></h3> +<div class="column-container"> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/XUL_Migration_Guide">XUL Migration Guide</a></dt> + <dd> + Techniques to help port a XUL add-on to the SDK.</dd> + <dt> + <a href="Guides/XUL_vs_SDK">XUL versus the SDK</a></dt> + <dd> + A comparison of the strengths and weaknesses of the SDK, compared to traditional XUL-based add-ons.</dd> + </dl> + </div> + <div class="column-half"> + <dl> + <dt> + <a href="Guides/Porting_the_Library_Detector">Porting Example</a></dt> + <dd> + A walkthrough of porting a relatively simple XUL-based add-on to the SDK.</dd> + </dl> + </div> +</div> +<p> </p> diff --git a/files/zh-tw/mozilla/add-ons/sdk/high-level_apis/context-menu/index.html b/files/zh-tw/mozilla/add-ons/sdk/high-level_apis/context-menu/index.html new file mode 100644 index 0000000000..42c5e0ca85 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/sdk/high-level_apis/context-menu/index.html @@ -0,0 +1,588 @@ +--- +title: context-menu +slug: Mozilla/Add-ons/SDK/High-Level_APIs/context-menu +translation_of: Archive/Add-ons/Add-on_SDK/High-Level_APIs/context-menu +--- +<div class="note"> + <p>Stable</p> +</div> +<p><span class="seoSummary">加入選單項目、子選單、選單分隔線到頁面右鍵選單。</span></p> +<h2 id="用法">用法</h2> +<p>Instead of manually adding items when particular contexts occur and then removing them when those contexts go away, you <em>bind</em> items to contexts, and the adding and removing is automatically handled for you. Items are bound to contexts in much the same way that event listeners are bound to events. When the user invokes the context menu, all of the items bound to the current context are automatically added to the menu. If no items are bound, none are added. Likewise, any items that were previously in the menu but are not bound to the current context are automatically removed from the menu. You never need to manually remove your items from the menu unless you want them to never appear again.</p> +<p>For example, if your add-on needs to add a context menu item whenever the user visits a certain page, don't create the item when that page loads, and don't remove it when the page unloads. Rather, create your item only once and supply a context that matches the target URL.</p> +<p>Context menu items are displayed in the order created or in the case of sub menus the order added to the sub menu. Menu items for each add-on will be grouped together automatically. If the total number of menu items in the main context menu from all add-ons exceeds a certain number (normally 10 but configurable with the <code>extensions.addon-sdk.context-menu.overflowThreshold</code> preference) all of the menu items will instead appear in an overflow menu to avoid making the context menu too large.</p> +<h3 id="Specifying_Contexts">Specifying Contexts</h3> +<p>As its name implies, the context menu should be reserved for the occurrence of specific contexts. Contexts can be related to page content or the page itself, but they should never be external to the page.</p> +<p>For example, a good use of the menu would be to show an "Edit Image" item when the user right-clicks an image in the page. A bad use would be to show a submenu that listed all the user's tabs, since tabs aren't related to the page or the node the user clicked to open the menu.</p> +<h4 id="The_Page_Context">The Page Context</h4> +<p>First of all, you may not need to specify a context at all. When a top-level item does not specify a context, the page context applies. An item that is in a submenu is visible unless you specify a context.</p> +<p>The <em>page context</em> occurs when the user invokes the context menu on a non-interactive portion of the page. Try right-clicking a blank spot in this page, or on text. Make sure that no text is selected. The menu that appears should contain the items "Back", "Forward", "Reload", "Stop", and so on. This is the page context.</p> +<p>The page context is appropriate when your item acts on the page as a whole. It does not occur when the user invokes the context menu on a link, image, or other non-text node, or while a selection exists.</p> +<h4 id="宣告式場景條件(Declarative_Contexts)">宣告式場景條件(Declarative Contexts)</h4> +<p>當你藉由設定 <code>context</code> 屬性(該屬性為: 傳給 constructor 的選項物件之屬性)來新增選單項目時,你可以指定一些簡單的宣告式場景條件, 如下:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "My Menu Item", + context: cm.URLContext("*.mozilla.org") +});</pre> +<table class="standard-table"> + <tbody> + <tr> + <th>Constructor</th> + <th>選單項目出現的條件</th> + </tr> + <tr> + <td><code>PageContext() </code></td> + <td>當場景為網頁時.</td> + </tr> + <tr> + <td><code>SelectionContext() </code></td> + <td>當使用者在網頁上選取項目時.</td> + </tr> + <tr> + <td><code>SelectorContext(selector) </code></td> + <td>當選單在符合下述條件之一的節點上顯示: <code>selector</code>匹配, CSS 選擇器, 或 其祖先節點匹配選擇器. <code>selector</code>可以有多個(以逗點分隔), 例如, <code>"a[href], img"</code>.</td> + </tr> + <tr> + <td><code>URLContext(matchPattern) </code></td> + <td>特定網址的網頁. <code>matchPattern</code> is a match pattern string or an array of match pattern strings. 當 <code>matchPattern</code> 是陣列, 網址符合任何陣列元素之一時. These are the same match pattern strings that you use with the <a href="/en-US/Add-ons/SDK/High-Level_APIs/page-mod"><code>page-mod</code></a> <code>include</code> property. <a href="/en-US/Add-ons/SDK/Low-Level_APIs/util_match-pattern">Read more about patterns</a>.</td> + </tr> + <tr> + <td><code>PredicateContext(predicateFunction)</code></td> + <td>當選單被觸發時,<code>predicateFunction</code> 函數被呼叫,若函數傳回值為真值,則選單項目顯示。這函數傳入一物件,物件有著描述選單觸發場景條件的屬性.</td> + </tr> + <tr> + <td>array</td> + <td>An array of any of the other types. This context occurs when all contexts in the array occur.</td> + </tr> + </tbody> +</table> +<p>選單項目也有 <code>context</code> 屬性,可以用在新增或移除宣告式場景條件,當建構後. 例如:</p> +<pre class="brush: js">var context = require("sdk/context-menu").SelectorContext("img"); +myMenuItem.context.add(context); +myMenuItem.context.remove(context);</pre> +<p>當選單項目被指定了多個場景條件, 選單項目顯示於所有場景條件皆成立時.</p> +<h3 id="In_Content_Scripts">In Content Scripts</h3> +<p>宣告式場景條件很容易使用,但功能不強. 舉例來說, 你希望選單項目出現的條件為:「有著至少一張圖片的頁面」, 但宣告式場景條件並不能達成這一點.</p> +<p>當你需要對選單項目的出現時機有著更多的控制, 你可以使用 content scripts. 如同 SDK 的其他 APIs 一樣, <code>context-menu</code> API 使用 <a href="/en-US/Add-ons/SDK/Guides/Content_Scripts">content scripts</a> 以讓你的附加元件與瀏覽器中的頁面互動. 在最上層選單的每一個選單項目可以使用 content script.</p> +<p>每當選單即將顯示時,一個特殊事件,其名為 <code>"context"</code> ,觸發於你的 content scripts. 如果你為這個事件註冊了偵聽(listener)函數,當函數傳回真值時, 與偵聽函數關聯的選單項目會被顯示於選單中.</p> +<p>下例中, 當選單觸發於「有著至少一張圖片的頁面」時,顯示選單項目.</p> +<pre class="brush: js">require("sdk/context-menu").Item({ + label: "This Page Has Images", + contentScript: 'self.on("context", function (node) {' + + ' return !!document.querySelector("img");' + + '});' +});</pre> +<p>需要注意的是偵聽函數有一個參數叫 <code>node</code>. 這個 node 指的是使用者在頁面上按右鍵來觸發選單的頁面觸發節點. 你可以使用它來決定是否要顯示選單項目.</p> +<p>你可以在 content script 中,同時指定宣告式場景條件和 context 偵聽函數. 在這種情況下, 先評估宣告式場景條件, 然後你的選單項目顯示條件為:所有宣告式場景條件成立,並且你的 context 偵聽函數傳回真值.</p> +<p>如果任一宣告式場景條件未成立, 那麼你的 context 偵聽函數不會被呼叫. 下面的例子利用了這點. 確保了偵聽函數只在 image <code>node</code> 上觸發選單時,才會被呼叫:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "A Mozilla Image", + context: cm.SelectorContext("img"), + contentScript: 'self.on("context", function (node) {' + + ' return /mozilla/.test(node.src);' + + '});' +});</pre> +<p>However, if you do combine <code>SelectorContext</code> and the <code>"context"</code> event, be aware that the <code>node</code> argument passed to the <code>"context"</code> event will not always match the type specified in <code>SelectorContext</code>.</p> +<p><code>SelectorContext</code> will match if the menu is invoked on the node specified <em>or any descendant of that node</em>, but the <code>"context"</code> event handler is passed <em>the actual node</em> on which the menu was invoked. 上個例子有作用,是因為 <code><IMG></code> 元素內不能包含其他元素, 但底下的例子裡, <code>node.nodeName</code> 不能保證是 "P" - 例如說, 當使用者在一個段落(<code><P></code>)的連結(<code><A></code>)上點右鍵時,它不會是 "P" :</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "A Paragraph", + context: cm.SelectorContext("p"), + contentScript: 'self.on("context", function (node) {' + + ' console.log(node.nodeName);' + + ' return true;' + + '});' +});</pre> +<p>The content script is executed for every page that a context menu is shown for. It will be executed the first time it is needed (i.e. 當右鍵選單第一次顯示,並且選單項目的所有宣告式場景條件皆成立時) ,接著處於作用中,直到你銷毀你的選單項目或者關閉頁面.</p> +<h3 id="處理選單項目上的點擊">處理選單項目上的點擊</h3> +<p>content script 除了上述所說的功能(用來偵聽 <code>"context"</code> 事件)以外,你可以使用 content script 來處理選單項目上的點擊. 當使用者點擊選單項目時,一個名為 <code>"click"</code> 的事件在選單項目的 content script 內被觸發.</p> +<p>因此, 欲處理選單項目上的點擊, 可以藉由偵聽選單項目 content script 內的 <code>"click"</code> 事件, 如下:</p> +<pre class="brush: js">require("sdk/context-menu").Item({ + label: "My Item", + contentScript: 'self.on("click", function (node, data) {' + + ' console.log("Item clicked!");' + + '});' +});</pre> +<p>注意:偵聽函數有兩參數 <code>node</code> 和 <code>data</code>.</p> +<h4 id="node_參數">"node" 參數</h4> +<p><code>node</code> 是使用者右鍵點擊所觸發選單的節點.</p> +<ul> + <li>如果你未使用 <code>SelectorContext</code> 來決定是否顯示選單項目, 那麼這實際點擊的節點.</li> + <li>如果你使用了 <code>SelectorContext</code>, 那麼這是符合你的選擇器的那個節點.</li> +</ul> +<p>例如, 假設你的附加元件看起來像這樣:</p> +<pre class="brush: js">var script = "self.on('click', function (node, data) {" + + " console.log('clicked: ' + node.nodeName);" + + "});"; + +var cm = require("sdk/context-menu"); + +cm.Item({ + label: "body context", + context: cm.SelectorContext("body"), + contentScript: script +});</pre> +<p>這個附加元件建立了一個右鍵選單項目,該項目使用 <code>SelectorContext</code> 來顯示項目,顯示時機為:右鍵選單觸發於 <code><BODY></code> 元素的任何後代元素之上時. 點擊時, 項目記錄了 <a href="https://developer.mozilla.org/en-US/docs/DOM/Node.nodeName"><code>nodeName</code></a> 屬性(觸發選單的節點名稱)傳給點擊事件處理器.</p> +<p>如果你執行這個附加元件,你將看到它總是記錄 "BODY", 即使你點擊的是頁面上的段落元素<code><P></code>:</p> +<pre>info: contextmenu-example: clicked: BODY</pre> +<p>與上面對比, 底下的附加元件使用了 <code>PageContext</code>:</p> +<pre class="brush: js">var script = "self.on('click', function (node, data) {" + + " console.log('clicked: ' + node.nodeName);" + + "});"; + +var cm = require("sdk/context-menu"); + +cm.Item({ + label: "body context", + context: cm.PageContext(), + contentScript: script +});</pre> +<p>它將記錄實際點擊的節點名稱:</p> +<pre>info: contextmenu-example: clicked: P</pre> +<h4 id="data_參數">"data" 參數</h4> +<p><code>data</code> 是使用者所點擊選單項目的 <code>data</code>屬性. 注意: 當你有一個多層的選單(項目)時,點擊事件會被傳給被點擊的項目的所有祖先(項目),所以一定要驗證 <code>data</code> 值傳給你所期待的項目. 你可以使用 "data" 參數來簡化點擊事件處理 by providing just a single click listener on a <code>Menu</code> that reacts to clicks for any child items.:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Menu({ + label: "My Menu", + contentScript: 'self.on("click", function (node, data) {' + + ' console.log("You clicked " + data);' + + '});', + items: [ + cm.Item({ label: "Item 1", data: "item1" }), + cm.Item({ label: "Item 2", data: "item2" }), + cm.Item({ label: "Item 3", data: "item3" }) + ] +}); +</pre> +<h4 id="和附加元件通訊">和附加元件通訊</h4> +<p>時常,你需要收集一些訊息,在點擊偵聽函數內和執行一個無關於頁面動作. 為了與關聯於 content script 的選單項目通訊, content script 可以呼叫附屬於全域 <code>self</code> 物件的 <code>postMessage</code> 函數, 傳給它一些 JSON-able 資料. 選單項目的 <code>"message"</code> 事件偵聽函數將被呼叫(前述的 JSON-able 資料作為參數傳入).</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "Edit Image", + context: cm.SelectorContext("img"), + contentScript: 'self.on("click", function (node, data) {' + + ' self.postMessage(node.src);' + + '});', + onMessage: function (imgSrc) { + openImageEditor(imgSrc); + } +});</pre> +<h3 id="更新選單項目的文字標籤">更新選單項目的文字標籤</h3> +<p>Each menu item must be created with a label, but you can change its label later using a couple of methods.</p> +<p>最簡單的方法是設定選單項目的 <code>label</code> 屬性. 下面的例子更新選單項目的文字標籤為它被點擊的次數:</p> +<pre class="brush: js">var numClicks = 0; +var myItem = require("sdk/context-menu").Item({ + label: "Click Me: " + numClicks, + contentScript: 'self.on("click", self.postMessage);', + onMessage: function () { + numClicks++; + this.label = "Click Me: " + numClicks; + // Setting myItem.label is equivalent. + } +});</pre> +<p>Sometimes you might want to update the label based on the context. For instance, if your item performs a search with the user's selected text, it would be nice to display the text in the item to provide feedback to the user. 在這些情況下,你可以使用第二種方法 . 回想一下,你的 content scripts 可以偵聽 <code>"context"</code> 事件,如果你的偵聽函數傳回真值, 與 content scripts 關聯的選單項目會顯示在選單中. 除了傳回真值, 你的 <code>"context"</code> 偵聽函數也可以傳回字串. 當 <code>"context"</code> 偵聽函數傳回字串, 字串成為選單項目的新文字標籤.</p> +<p>This item implements the aforementioned search example:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "Search Google", + context: cm.SelectionContext(), + contentScript: 'self.on("context", function () {' + + ' var text = window.getSelection().toString();' + + ' if (text.length > 20)' + // 若太長 + ' text = text.substr(0, 20) + "...";' + // 則截短 + ' return "Search Google for " + text;' + // 後綴到固定字串上傳回 + '});' +});</pre> +<p><code>"context"</code> 偵聽函數取得使用者所選取的文字, 如果字串太長則截短它, 並後綴到固定字串上傳回. 當選單項目顯示, 它的文字標籤將是 "Search Google for <code>text</code>", 此處的 <code>text</code> 是被截短的 使用者所選取的文字.</p> +<h3 id="隱私視窗">隱私視窗</h3> +<p>If your add-on has not opted into private browsing, then any menus or menu items that you add will not appear in context menus belonging to private browser windows.</p> +<p>To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the <a href="/en-US/Add-ons/SDK/High-Level_APIs/private-browsing">documentation for the <code>private-browsing</code> module</a>.</p> +<h3 id="更多例子">更多例子</h3> +<p>For conciseness, these examples create their content scripts as strings and use the <code>contentScript</code> property. In your own add-on, you will probably want to create your content scripts in separate files and pass their URLs using the <code>contentScriptFile</code> property. See <a href="/en-US/Add-ons/SDK/Guides/Content_Scripts">Working with Content Scripts</a> for more information.</p> +<div class="warning"> + <p>Unless your content script is extremely simple and consists only of a static string, don't use <code>contentScript</code>: if you do, you may have problems getting your add-on approved on AMO.</p> + <p>Instead, keep the script in a separate file and load it using <code>contentScriptFile</code>. This makes your code easier to maintain, secure, debug and review.</p> +</div> +<p>Show an "Edit Page Source" item when the user right-clicks a non-interactive part of the page:</p> +<pre class="brush: js">require("sdk/context-menu").Item({ + label: "Edit Page Source", + contentScript: 'self.on("click", function (node, data) {' + + ' self.postMessage(document.URL);' + + '});', + onMessage: function (pageURL) { + editSource(pageURL); + } +});</pre> +<p>Show an "Edit Image" item when the menu is invoked on an image:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "Edit Image", + context: cm.SelectorContext("img"), + contentScript: 'self.on("click", function (node, data) {' + + ' self.postMessage(node.src);' + + '});', + onMessage: function (imgSrc) { + openImageEditor(imgSrc); + } +});</pre> +<p>Show an "Edit Mozilla Image" item when the menu is invoked on an image in a mozilla.org or mozilla.com page:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "Edit Mozilla Image", + context: [ + cm.URLContext(["*.mozilla.org", "*.mozilla.com"]), + cm.SelectorContext("img") + ], + contentScript: 'self.on("click", function (node, data) {' + + ' self.postMessage(node.src);' + + '});', + onMessage: function (imgSrc) { + openImageEditor(imgSrc); + } +});</pre> +<p>Show an "Edit Page Images" item when the page contains at least one image:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +cm.Item({ + label: "Edit Page Images", + // This ensures the item only appears during the page context. + context: cm.PageContext(), + contentScript: 'self.on("context", function (node) {' + + ' var pageHasImgs = !!document.querySelector("img");' + + ' return pageHasImgs;' + + '});' + + 'self.on("click", function (node, data) {' + + ' var imgs = document.querySelectorAll("img");' + + ' var imgSrcs = [];' + + ' for (var i = 0 ; i < imgs.length; i++)' + + ' imgSrcs.push(imgs[i].src);' + + ' self.postMessage(imgSrcs);' + + '});', + onMessage: function (imgSrcs) { + openImageEditor(imgSrcs); + } +});</pre> +<p>Show a "Search With" menu when the user right-clicks an anchor that searches Google or Wikipedia with the text contained in the anchor:</p> +<pre class="brush: js">var cm = require("sdk/context-menu"); +var googleItem = cm.Item({ + label: "Google", + data: "http://www.google.com/search?q=" +}); +var wikipediaItem = cm.Item({ + label: "Wikipedia", + data: "http://en.wikipedia.org/wiki/Special:Search?search=" +}); +var searchMenu = cm.Menu({ + label: "Search With", + context: cm.SelectorContext("a[href]"), + contentScript: 'self.on("click", function (node, data) {' + + ' var searchURL = data + node.textContent;' + + ' window.location.href = searchURL;' + + '});', + items: [googleItem, wikipediaItem] +});</pre> +<h2 id="Globals">Globals</h2> +<h3 id="Constructors">Constructors</h3> +<h4 class="addon-sdk-api-name" id="Item(options)"><code>Item(options)</code></h4> +<p>建立一個有文字標籤的選單項目,當點擊它時,可以執行一些動作.</p> +<h5 id="參數">參數</h5> +<p><strong>options : 物件</strong><br> + options 物件的必要屬性:</p> +<table class="standard-table"> + <thead> + <tr> + <th scope="col">名稱</th> + <th scope="col">型別</th> + <th scope="col"> </th> + </tr> + </thead> + <tbody> + <tr> + <td>label</td> + <td>字串</td> + <td> + <p>選單項目的文字標籤. It must either be a string or an object that implements <code>toString()</code>.</p> + </td> + </tr> + </tbody> +</table> +<p>options 物件的可選屬性:</p> +<table class="standard-table"> + <thead> + <tr> + <th scope="col">名稱</th> + <th scope="col">型別</th> + <th scope="col"> </th> + </tr> + </thead> + <tbody> + <tr> + <td>image</td> + <td>字串</td> + <td> + <p>選單項目的圖示, a string URL. The URL can be remote, a reference to an image in the add-on's <code>data</code> directory, or a data URI.</p> + </td> + </tr> + <tr> + <td>data</td> + <td>字串</td> + <td> + <p>An optional arbitrary value to associate with the item. It must be either a string or an object that implements <code>toString()</code>. It will be passed to click listeners.</p> + </td> + </tr> + <tr> + <td>accessKey</td> + <td>只有單一字元的字串</td> + <td> + <div class="geckoVersionNote"> + <p>New in Firefox 35.</p> + </div> + <p>選單項目的快捷鍵. Pressing this key selects the item when the context menu is open.</p> + </td> + </tr> + <tr> + <td>context</td> + <td>value</td> + <td> + <p>If the item is contained in the top-level context menu, this declaratively specifies the context under which the item will appear; see Specifying Contexts above.</p> + </td> + </tr> + <tr> + <td>contentScript</td> + <td>字串, 陣列</td> + <td> + <p>If the item is contained in the top-level context menu, this is the content script or an array of content scripts that the item can use to interact with the page.</p> + </td> + </tr> + <tr> + <td>contentScriptFile</td> + <td>字串, 陣列</td> + <td> + <p>If the item is contained in the top-level context menu, this is the local file URL of the content script or an array of such URLs that the item can use to interact with the page.</p> + </td> + </tr> + <tr> + <td>onMessage</td> + <td>函數</td> + <td> + <p>If the item is contained in the top-level context menu, this function will be called when the content script calls <code>self.postMessage</code>. It will be passed the data that was passed to <code>postMessage</code>.</p> + </td> + </tr> + </tbody> +</table> +<h4 class="addon-sdk-api-name" id="Menu(options)"><code>Menu(options)</code></h4> +<p>建立一個有文字標籤的選單項目,用以展開子選單.</p> +<h5 id="參數_2">參數</h5> +<p><strong>options : 物件</strong><br> + options 物件的必要屬性:</p> +<table class="standard-table"> + <thead> + <tr> + <th scope="col">名稱</th> + <th scope="col">型別</th> + <th scope="col"> </th> + </tr> + </thead> + <tbody> + <tr> + <td>label</td> + <td>字串</td> + <td> + <p>選單項目的文字標籤. It must either be a string or an object that implements <code>toString()</code>.</p> + </td> + </tr> + <tr> + <td>items</td> + <td>陣列</td> + <td> + <p>選單項目構成的陣列,這些選單項目會被子選單所包含. 陣列中的元素須為 <code>Item</code>, <code>Menu</code>, 或 <code>Separator</code>.</p> + </td> + </tr> + </tbody> +</table> +<p>options 物件的可選屬性:</p> +<table class="standard-table"> + <thead> + <tr> + <th scope="col">名稱</th> + <th scope="col">型別</th> + <th scope="col"> </th> + </tr> + </thead> + <tbody> + <tr> + <td>image</td> + <td>字串</td> + <td> + <p>The menu's icon, a string URL. The URL can be remote, a reference to an image in the add-on's <code>data</code> directory, or a data URI.</p> + </td> + </tr> + <tr> + <td>context</td> + <td>value</td> + <td> + <p>If the menu is contained in the top-level context menu, this declaratively specifies the context under which the menu will appear; see Specifying Contexts above.</p> + </td> + </tr> + <tr> + <td>contentScript</td> + <td>字串, 陣列</td> + <td> + <p>If the menu is contained in the top-level context menu, this is the content script or an array of content scripts that the menu can use to interact with the page.</p> + </td> + </tr> + <tr> + <td>contentScriptFile</td> + <td>字串, 陣列</td> + <td> + <p>If the menu is contained in the top-level context menu, this is the local file URL of the content script or an array of such URLs that the menu can use to interact with the page.</p> + </td> + </tr> + <tr> + <td>onMessage</td> + <td>函數</td> + <td> + <p>If the menu is contained in the top-level context menu, this function will be called when the content script calls <code>self.postMessage</code>. It will be passed the data that was passed to <code>postMessage</code>.</p> + </td> + </tr> + </tbody> +</table> +<h4 class="addon-sdk-api-name" id="Separator()"><code>Separator()</code></h4> +<p>Creates a menu separator.</p> +<h4 class="addon-sdk-api-name" id="PageContext()"><code>PageContext()</code></h4> +<p>Creates a page context. See Specifying Contexts above.</p> +<h4 class="addon-sdk-api-name" id="SelectionContext()"><code>SelectionContext()</code></h4> +<p>Creates a context that occurs when a page contains a selection. See Specifying Contexts above.</p> +<h4 class="addon-sdk-api-name" id="SelectorContext(selector)"><code>SelectorContext(selector)</code></h4> +<p>Creates a context that matches a given CSS selector. See Specifying Contexts above.</p> +<h5 id="Parameters">Parameters</h5> +<p><strong>selector : string</strong><br> + A CSS selector.</p> +<h4 class="addon-sdk-api-name" id="URLContext(matchPattern)"><code>URLContext(matchPattern)</code></h4> +<p>Creates a context that matches pages with particular URLs. See Specifying Contexts above.</p> +<h5 id="Parameters_2">Parameters</h5> +<p><strong>matchPattern : string,array</strong><br> + A <a href="/en-US/Add-ons/SDK/Low-Level_APIs/util_match-pattern">match pattern</a> string, regexp or an array of match pattern strings or regexps.</p> +<h4 class="addon-sdk-api-name" id="PredicateContext(predicateFunction)"><code>PredicateContext(predicateFunction)</code></h4> +<div class="geckoVersionNote"> + <p>New in Firefox 29</p> +</div> +<p>Creates a context that occurs when predicateFunction returns a true value. See Specifying Contexts above.</p> +<h5 id="Parameters_3">Parameters</h5> +<p><strong>predicateFunction : function(context)</strong><br> + A function which will be called with an object argument that provide information about the invocation context. <code>context</code> object properties:</p> +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Property</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>documentType</code></td> + <td>The MIME type of the document the menu was invoked in. E.g. <code>text/html</code> for HTML pages, <code>application/xhtml+xml</code> for XHTML, or <code>image/jpeg</code> if viewing an image directly.</td> + </tr> + <tr> + <td><code>documentURL</code></td> + <td>The URL of the document the menu was invoked in.</td> + </tr> + <tr> + <td><code>targetName</code></td> + <td>The name of the DOM element that the menu was invoked on, in lower-case.</td> + </tr> + <tr> + <td><code>targetID</code></td> + <td>The <code>id</code> attribute of the element that the menu was invoked on, or <code>null</code> if not set.</td> + </tr> + <tr> + <td><code>isEditable</code></td> + <td><code>true</code> if the menu was invoked in an editable element, and that element isn't disabled or read-only. This includes non-input elements with the <code>contenteditable</code> attribute set to <code>true</code>.</td> + </tr> + <tr> + <td><code>selectionText</code></td> + <td>The current selection as a text string, or <code>null</code>. If the menu was invoked in an input text box or area, this is the selection of that element, otherwise the selection in the contents of the window.</td> + </tr> + <tr> + <td><code>srcURL</code></td> + <td>The <code>src</code> URL of the element that the menu was invoked on, or <code>null</code> if it doesn't have one.</td> + </tr> + <tr> + <td><code>linkURL</code></td> + <td>The <code>href</code> URL of the element that the menu was invoked on, or <code>null</code> if it doesn't have one.</td> + </tr> + <tr> + <td><code>value</code></td> + <td>The current contents of a input text box or area if the menu was invoked in one, <code>null</code> otherwise.</td> + </tr> + </tbody> +</table> +<h2 id="Item">Item</h2> +<p>A labeled menu item that can perform an action when clicked.</p> +<h3 id="Methods">Methods</h3> +<h4 class="addon-sdk-api-name" id="destroy()"><code>destroy()</code></h4> +<p>Permanently removes the item from its parent menu and frees its resources. The item must not be used afterward. If you need to remove the item from its parent menu but use it afterward, call <code>removeItem()</code> on the parent menu instead.</p> +<h3 id="Properties">Properties</h3> +<h4 class="addon-sdk-api-name" id="label"><code>label</code></h4> +<p>The menu item's label. You can set this after creating the item to update its label later.</p> +<h4 class="addon-sdk-api-name" id="image"><code>image</code></h4> +<p>The item's icon, a string URL. The URL can be remote, a reference to an image in the add-on's <code>data</code> directory, or a data URI. You can set this after creating the item to update its image later. To remove the item's image, set it to <code>null</code>.</p> +<h4 class="addon-sdk-api-name" id="data"><code>data</code></h4> +<p>An optional arbitrary value to associate with the item. It must be either a string or an object that implements <code>toString()</code>. It will be passed to click listeners. You can set this after creating the item to update its data later.</p> +<h4 class="addon-sdk-api-name" id="context"><code>context</code></h4> +<p>A list of declarative contexts for which the menu item will appear in the context menu. Contexts can be added by calling <code>context.add()</code> and removed by called <code>context.remove()</code>.</p> +<h4 class="addon-sdk-api-name" id="parentMenu"><code>parentMenu</code></h4> +<p>The item's parent <code>Menu</code>, or <code>null</code> if the item is contained in the top-level context menu. This property is read-only. To add the item to a new menu, call that menu's <code>addItem()</code> method.</p> +<h4 class="addon-sdk-api-name" id="contentScript"><code>contentScript</code></h4> +<p>The content script or the array of content scripts associated with the menu item during creation.</p> +<h4 class="addon-sdk-api-name" id="contentScriptFile"><code>contentScriptFile</code></h4> +<p>The URL of a content script or the array of such URLs associated with the menu item during creation.</p> +<h3 id="Events">Events</h3> +<h4 class="addon-sdk-api-name" id="message"><code>message</code></h4> +<p>If you listen to this event you can receive message events from content scripts associated with this menu item. When a content script posts a message using <code>self.postMessage()</code>, the message is delivered to the add-on code in the menu item's <code>message</code> event.</p> +<h5 id="Arguments">Arguments</h5> +<p><strong>value</strong> : Listeners are passed a single argument which is the message posted from the content script. The message can be any <a href="/en-US/Add-ons/SDK/Guides/Content_Scripts/using_port#JSON-Serializable_Values">JSON-serializable value</a>.</p> +<h2 id="Menu">Menu</h2> +<p>A labeled menu item that expands into a submenu.</p> +<h3 id="Methods_2">Methods</h3> +<h4 class="addon-sdk-api-name" id="addItem(item)"><code>addItem(item)</code></h4> +<p>Appends a menu item to the end of the menu. If the item is already contained in another menu or in the top-level context menu, it's automatically removed first. If the item is already contained in this menu it will just be moved to the end of the menu.</p> +<h5 id="Parameters_4">Parameters</h5> +<p><strong>item : Item,Menu,Separator</strong><br> + The <code>Item</code>, <code>Menu</code>, or <code>Separator</code> to add to the menu.</p> +<h4 class="addon-sdk-api-name" id="removeItem(item)"><code>removeItem(item)</code></h4> +<p>Removes the given menu item from the menu. If the menu does not contain the item, this method does nothing.</p> +<h5 id="Parameters_5">Parameters</h5> +<p><strong>item : Item,Menu,Separator</strong><br> + The menu item to remove from the menu.</p> +<h4 class="addon-sdk-api-name" id="destroy()_2"><code>destroy()</code></h4> +<p>Permanently removes the menu from its parent menu and frees its resources. The menu must not be used afterward. If you need to remove the menu from its parent menu but use it afterward, call <code>removeItem()</code> on the parent menu instead.</p> +<h3 id="Properties_2">Properties</h3> +<h4 class="addon-sdk-api-name" id="label_2"><code>label</code></h4> +<p>The menu's label. You can set this after creating the menu to update its label later.</p> +<h4 class="addon-sdk-api-name" id="items"><code>items</code></h4> +<p>An array containing the items in the menu. The array is read-only, meaning that modifications to it will not affect the menu. However, setting this property to a new array will replace all the items currently in the menu with the items in the new array.</p> +<h4 class="addon-sdk-api-name" id="image_2"><code>image</code></h4> +<p>The menu's icon, a string URL. The URL can be remote, a reference to an image in the add-on's <code>data</code> directory, or a data URI. You can set this after creating the menu to update its image later. To remove the menu's image, set it to <code>null</code>.</p> +<h4 class="addon-sdk-api-name" id="context_2"><code>context</code></h4> +<p>A list of declarative contexts for which the menu will appear in the context menu. Contexts can be added by calling <code>context.add()</code> and removed by called <code>context.remove()</code>.</p> +<h4 class="addon-sdk-api-name" id="parentMenu_2"><code>parentMenu</code></h4> +<p>The menu's parent <code>Menu</code>, or <code>null</code> if the menu is contained in the top-level context menu. This property is read-only. To add the menu to a new menu, call that menu's <code>addItem()</code> method.</p> +<h4 class="addon-sdk-api-name" id="contentScript_2"><code>contentScript</code></h4> +<p>The content script or the array of content scripts associated with the menu during creation.</p> +<h4 class="addon-sdk-api-name" id="contentScriptFile_2"><code>contentScriptFile</code></h4> +<p>The URL of a content script or the array of such URLs associated with the menu during creation.</p> +<h3 id="Events_2">Events</h3> +<h4 class="addon-sdk-api-name" id="message_2"><code>message</code></h4> +<p>If you listen to this event you can receive message events from content scripts associated with this menu item. When a content script posts a message using <code>self.postMessage()</code>, the message is delivered to the add-on code in the menu item's <code>message</code> event.</p> +<h5 id="Arguments_2">Arguments</h5> +<p><strong>value</strong> : Listeners are passed a single argument which is the message posted from the content script. The message can be any <a href="/en-US/Add-ons/SDK/Guides/Content_Scripts/using_port#JSON-Serializable_Values">JSON-serializable value</a>.</p> +<h2 id="Separator">Separator</h2> +<p>A menu separator. Separators can be contained only in <code>Menu</code>s, not in the top-level context menu.</p> +<h3 id="Methods_3">Methods</h3> +<h4 class="addon-sdk-api-name" id="destroy()_3"><code>destroy()</code></h4> +<p>Permanently removes the separator from its parent menu and frees its resources. The separator must not be used afterward. If you need to remove the separator from its parent menu but use it afterward, call <code>removeItem()</code> on the parent menu instead.</p> +<h3 id="Properties_3">Properties</h3> +<h4 class="addon-sdk-api-name" id="parentMenu_3"><code>parentMenu</code></h4> +<p>The separator's parent <code>Menu</code>. This property is read-only. To add the separator to a new menu, call that menu's <code>addItem()</code> method.</p> diff --git a/files/zh-tw/mozilla/add-ons/sdk/high-level_apis/index.html b/files/zh-tw/mozilla/add-ons/sdk/high-level_apis/index.html new file mode 100644 index 0000000000..32b39d045b --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/sdk/high-level_apis/index.html @@ -0,0 +1,10 @@ +--- +title: High-Level APIs +slug: Mozilla/Add-ons/SDK/High-Level_APIs +tags: + - NeedsTranslation + - TopicStub +translation_of: Archive/Add-ons/Add-on_SDK/High-Level_APIs +--- +<p>Modules listed on this page implement high-level APIs for building add-ons: creating user interfaces, interacting with the web, and interacting with the browser.</p> +<p>Unless the documentation explicitly says otherwise, all these modules are "Stable": we'll avoid making incompatible changes to them. {{ LandingPageListSubpages ("/en-US/Add-ons/SDK/High-Level_APIs", 5) }}</p> diff --git a/files/zh-tw/mozilla/add-ons/sdk/index.html b/files/zh-tw/mozilla/add-ons/sdk/index.html new file mode 100644 index 0000000000..2937b883d7 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/sdk/index.html @@ -0,0 +1,82 @@ +--- +title: Add-on SDK +slug: Mozilla/Add-ons/SDK +tags: + - NeedsTranslation + - TopicStub +translation_of: Archive/Add-ons/Add-on_SDK +--- +<p>有了附加元件開發套件(Add-on SDK),您可以使用標準的JavaScript、HTML、CSS等語法來建立Firefox的附加元件。SDK包含用來製作附加元件的JavaScript API,及建立、測試、運行或包裝附加元件的相關工具。</p> + +<hr> +<h3 id="入門">入門</h3> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#getting-started">從此開始</a></dt> + <dd>如何<a href="/en-US/Add-ons/SDK/Tutorials/Installation">安裝 SDK </a>及<a href="/en-US/Add-ons/SDK/Tutorials/Getting_Started_With_cfx">使用 cfx tool </a>來建立、測試或包裝附加元件。</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#interact-with-the-browser">和瀏覽器互動</a></dt> + <dd><a href="/en-US/Add-ons/SDK/Tutorials/Open_a_Web_Page">開啟網頁</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Listen_For_Page_Load">監測頁面載入</a>以及<a href="/en-US/Add-ons/SDK/Tutorials/List_Open_Tabs">列出已開啟頁面</a>。</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#development-techniques">開發技巧</a></dt> + <dd>學習常用開發技術,如<a href="/en-US/Add-ons/SDK/Tutorials/Unit_testing">單元測試</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Logging">紀錄</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Creating_Reusable_Modules">建立可重用模組</a>、<a href="/en-US/Add-ons/SDK/Tutorials/l10n">在地化</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Mobile_development">流動裝置</a> 。</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#create-user-interfaces">建立使用者介面的元件</a></dt> + <dd>如<a href="/en-US/Add-ons/SDK/Tutorials/Adding_a_Button_to_the_Toolbar">工具列按鈕</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Add_a_Context_Menu_Item">內文選單</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Add_a_Menu_Item_to_Firefox">選單項目</a>、<a href="/en-US/Add-ons/SDK/Tutorials/Display_a_Popup">對話框</a>等等。</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#modify-web-pages">修改網頁</a></dt> + <dd>修改<a href="/en-US/Add-ons/SDK/Tutorials/Modifying_Web_Pages_Based_on_URL">符合網址模式</a>的頁面或動態<a href="/en-US/Add-ons/SDK/Tutorials/Modifying_the_Page_Hosted_by_a_Tab">修改特定分頁</a>。</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials/Annotator">整合各項</a></dt> + <dd>以 Annotator(一個顯示註解的附加元件)為例顯示製作流程。</dd> +</dl> +</div> +</div> + +<hr> +<h3 id="指引">指引</h3> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Guides#contributors-guide">貢獻者指南</a></dt> + <dd>學習<a href="/en-US/Add-ons/SDK/Guides/Getting_Started">如何貢獻 </a>SDK 以及 SDK 當中的重要術語,如<a href="/en-US/Add-ons/SDK/Guides/Modules">模組</a>、<a href="/en-US/Add-ons/SDK/Guides/Classes_and_Inheritance">類(Class)及繼承(Inheritance)</a>、<a href="/en-US/Add-ons/SDK/Guides/Private_Properties">私有屬性</a>以及<a href="/en-US/Add-ons/SDK/Guides/Content_Processes">內容處理</a>。</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides#sdk-infrastructure">SDK infrastructure</a></dt> + <dd>Aspects of the SDK's underlying technology: <a href="/en-US/Add-ons/SDK/Guides/Module_structure_of_the_SDK">modules</a>, the <a href="/en-US/Add-ons/SDK/Guides/Program_ID">Program ID</a>, and the rules defining <a href="/en-US/Add-ons/SDK/Guides/Firefox_Compatibility">Firefox compatibility</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides/Content_Scripts">Content scripts</a></dt> + <dd>A detailed guide to <a href="/en-US/Add-ons/SDK/Guides/Content_Scripts">working with content scripts</a>, including: <a href="/en-US/Add-ons/SDK/Guides/Loading_content_scripts">how to load content scripts</a>, <a href="/en-US/Add-ons/SDK/Guides/Accessing_the_DOM">which objects content scripts can access</a>, and <a href="/en-US/Add-ons/SDK/Guides/Communicating_with_other_scripts">how to communicate between content scripts and the rest of your add-on</a>.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Guides#sdk-idioms">SDK idioms</a></dt> + <dd>The SDK's <a href="/en-US/Add-ons/SDK/Guides/Working_with_Events">event framework</a> and the <a href="/en-US/Add-ons/SDK/Guides/Two_Types_of_Scripts">distinction between add-on scripts and content scripts</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides/XUL_Migration_Guide">XUL migration</a></dt> + <dd>A guide to <a href="/en-US/Add-ons/SDK/Guides/XUL_Migration_Guide">porting XUL add-ons to the SDK</a>. This guide includes a <a href="/en-US/Add-ons/SDK/Guides/XUL_vs_SDK">comparison of the two toolsets</a> and a <a href="/en-US/Add-ons/SDK/Guides/Porting_the_Library_Detector">working example</a> of porting a XUL add-on.</dd> +</dl> +</div> +</div> + +<hr> +<h3 id="參考資料">參考資料</h3> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/High-Level_APIs">高階 API</a></dt> + <dd>高階 SDK API 的參考文件。</dd> + <dt><a href="/en-US/Add-ons/SDK/Tools">工具參考</a></dt> + <dd>Reference documentation for the <a href="/en-US/Add-ons/SDK/Tools/cfx">cfx tool</a> used to develop, test, and package add-ons, the <a href="/en-US/Add-ons/SDK/Tools/console">console</a> global used for logging, and the <a href="/en-US/Add-ons/SDK/Tools/package_json">package.json</a> file.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Low-Level_APIs">低階 API</a></dt> + <dd>低階 SDK API 的參考文件。</dd> +</dl> +</div> +</div> diff --git a/files/zh-tw/mozilla/add-ons/sdk/low-level_apis/index.html b/files/zh-tw/mozilla/add-ons/sdk/low-level_apis/index.html new file mode 100644 index 0000000000..2108d30783 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/sdk/low-level_apis/index.html @@ -0,0 +1,20 @@ +--- +title: Low-Level APIs +slug: Mozilla/Add-ons/SDK/Low-Level_APIs +translation_of: Archive/Add-ons/Add-on_SDK/Low-Level_APIs +--- +<p>Modules in this section implement low-level APIs. These modules fall roughly into three categories:</p> +<ul> + <li> + <p>fundamental utilities such as <a href="/en-US/Add-ons/SDK/Low-Level_APIs/util_collection">collection</a>. Many add-ons are likely to want to use modules from this category.</p> + </li> + <li> + <p>building blocks for higher level modules, such as <a href="/en-US/Add-ons/SDK/Low-Level_APIs/event_core">events</a> and <a href="/en-US/Add-ons/SDK/Low-Level_APIs/content_worker">worker</a>. You're more likely to use these if you are building your own modules that implement new APIs, thus extending the SDK itself.</p> + </li> + <li> + <p>privileged modules that expose powerful low-level capabilities such as <a href="/en-US/Add-ons/SDK/Low-Level_APIs/window_utils">window/utils</a> and <a href="/en-US/Add-ons/SDK/Low-Level_APIs/net_xhr">net/xhr</a>. You can use these modules in your add-on if you need to, but should be aware that the cost of privileged access is the need to take more elaborate security precautions. In many cases these modules have simpler, more restricted analogs among the "High-Level APIs" (for example, <a href="/en-US/Add-ons/SDK/High-Level_APIs/windows">windows</a> or <a href="/en-US/Add-ons/SDK/High-Level_APIs/request">request</a>).</p> + </li> +</ul> +<p>These modules are still in active development, and we expect to make incompatible changes to them in future releases.</p> +<p>{{ LandingPageListSubpages ("/en-US/Add-ons/SDK/Low-Level_APIs", 5) }}</p> +<p> </p> diff --git a/files/zh-tw/mozilla/add-ons/themes/obsolete/index.html b/files/zh-tw/mozilla/add-ons/themes/obsolete/index.html new file mode 100644 index 0000000000..d420b6ebf0 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/themes/obsolete/index.html @@ -0,0 +1,10 @@ +--- +title: Obsolete +slug: Mozilla/Add-ons/Themes/Obsolete +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/Themes/Obsolete +--- +<p>This page collects theme docs that we don't expect will ever be updated, but which we're keeping for the time being as potential source material for updated docs.</p> +<p>{{ ListSubPages ("/en-US/Add-ons/Themes/Obsolete", 5) }}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/anatomy_of_a_webextension/index.html b/files/zh-tw/mozilla/add-ons/webextensions/anatomy_of_a_webextension/index.html new file mode 100644 index 0000000000..505642ac10 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/anatomy_of_a_webextension/index.html @@ -0,0 +1,139 @@ +--- +title: Anatomy of an extension +slug: Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension +translation_of: Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension +--- +<div>{{AddonSidebar}}</div> + +<p>附加元件是一群檔案的集合,基於發布及安裝的目的而包裝成一個檔案。在這個章節,我們將快速地瀏覽這些可能會放在附加元件中的檔案。</p> + +<h2 id="manifest.json">manifest.json</h2> + +<p>這是每個附加元件中,唯一一個必要放置的檔案。它包含了附加元件的名稱、版本、及需要的權限等資訊,同時也提供了附加元件中其他檔案的路徑指標。</p> + +<p>這份manifest也可以包含幾項其他種類檔案的指標路徑:</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">Background pages</a>: 實作長時間執行的邏輯。</li> + <li>附加元件的圖示及任何定義的按鈕。</li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Sidebars_popups_options_pages">Sidebars, popups, and options pages</a>: 提供各種使用者介面元件的 HTML 文件。</li> + <li><a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Content_scripts">Content scripts</a>: 包含於你附加元件中的 JavaScript。你將會利用它注入到網頁中。</li> +</ul> + +<p><img alt="" src="https://mdn.mozillademos.org/files/13669/webextension-anatomy.png" style="display: block; height: 581px; margin-left: auto; margin-right: auto; width: 600px;"></p> + +<p>參考 <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> 參考頁取得全部的明細。</p> + +<p>除了那些參考自manifest之外,附加元件可以包含額外支援的檔案作為 <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Extension_pages">Extension pages</a> 。</p> + +<h2 id="Background_scripts_後台腳本">Background scripts 後台腳本</h2> + +<p>擴展套件通常需要保持長期狀態或長時間執行操作,而生命週期不依賴於任何特定網頁或瀏覽器視窗。這是後台腳本的用途。</p> + +<p>後台腳本會在擴充套件讀取時立即執行且會持續執行直到擴充套件被禁用或是解除安裝。你可以在腳本裡使用任何WebExtension APIs, 只要你已經申請了必要的權限。</p> + +<h3 id="Specifying_background_scripts_載入後台腳本">Specifying background scripts 載入後台腳本</h3> + +<p>你可以在"manifest.json"裡使用<code>background</code>關鍵字用來包含後台腳本。</p> + +<pre class="brush: json">// manifest.json + +"background": { + "scripts": ["background-script.js"] +}</pre> + +<p>你可以同時載入後台腳本,而他們會運行於相同的環境中,就像是在一個網頁中同時載入一樣。</p> + +<p>然而,你也可以先載入一個後台頁面,然後在後台頁面中載入腳本。這樣的做法能為後台腳本提供 ES 6 模組的支援,算是一个優點。</p> + +<p style="margin-bottom: 0em;"><strong>manifest.json</strong></p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="comment token">// manifest.json</span> + +<span class="key token">"background":</span> <span class="punctuation token">{</span> + <span class="key token">"page":</span> <span class="string token">"background-page.html"</span> +<span class="punctuation token">}</span></code></pre> + +<p style="margin-bottom: 0em;"><strong>background-page.html</strong></p> + +<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="doctype token"><!DOCTYPE html></span> +<span class="tag token"><span class="tag token"><span class="punctuation token"><</span>html</span> <span class="attr-name token">lang</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"zh-tw</span><span class="punctuation token">"</span></span><span class="punctuation token">></span></span> + <span class="tag token"><span class="tag token"><span class="punctuation token"><</span>head</span><span class="punctuation token">></span></span> + <span class="tag token"><span class="tag token"><span class="punctuation token"><</span>meta</span> <span class="attr-name token">charset</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>utf-8<span class="punctuation token">"</span></span><span class="punctuation token">></span></span> + <span class="tag token"><span class="tag token"><span class="punctuation token"><</span>script</span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>module<span class="punctuation token">"</span></span> <span class="attr-name token">src</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>background-script.js<span class="punctuation token">"</span></span><span class="punctuation token">></span></span><span class="tag token"><span class="tag token"><span class="punctuation token"></</span>script</span><span class="punctuation token">></span></span> + <span class="tag token"><span class="tag token"><span class="punctuation token"></</span>head</span><span class="punctuation token">></span></span> +<span class="tag token"><span class="tag token"><span class="punctuation token"></</span>html</span><span class="punctuation token">></span></span></code></pre> + +<h3 id="Background_script_environment_後台腳本環境">Background script environment 後台腳本環境</h3> + +<h4 id="DOM_APIs">DOM APIs</h4> + +<p>後台腳本運行在一個特殊的網頁中,我們稱之為後台頁面(background pages) 。這個頁面會給予他們一個全域的變數<a href="/zh-TW/docs/Web/API/Window">window</a>,並且<span class="tlid-translation translation"><span title="">提供腳本使用所有的標準DOM API。</span></span></p> + +<h4 id="WebExtension_APIs">WebExtension APIs</h4> + +<p>只要你請求了必要的<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">權限</a>後,後台腳本可以使用任何的<a href="/en-US/Add-ons/WebExtensions/API">WebExtension APIs</a> 。</p> + +<h4 id="Cross-origin_access_跨域請求">Cross-origin access 跨域請求</h4> + +<p>當後台腳本擁有<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">host permissions </a>時,便能像任何主機發送 XHR 請求。</p> + +<h4 id="Web_content_網頁內容">Web content 網頁內容</h4> + +<p>後台腳本沒辦法直接的存取前端的網頁。然而,你可以載入 <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> 到前端網頁後,<a href="/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts">透過message-passing API 來與 content scripts 進行通訊</a> 。</p> + +<h4 id="Content_security_policy_內容安全策略">Content security policy 內容安全策略</h4> + +<p>依據内容安全策略(Content Security Policy),後台腳本不能執行一些可能有危險的操作,例如使用 <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code>。 詳情请参考<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy">内容安全策略</a>。</p> + +<h2 id="Sidebars_popups_options_pages側邊欄、彈出視窗、選項頁面">Sidebars, popups, options pages側邊欄、彈出視窗、選項頁面</h2> + +<p>Your extension can include various user interface components whose content is defined using an HTML document:</p> + +<ul> + <li>a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Sidebars">sidebar</a> is a pane that is displayed at the left-hand side of the browser window, next to the web page</li> + <li>a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">popup</a> is a dialog that you can display when the user clicks on a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_action">toolbar button</a> or <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Page_actions">address bar button</a></li> + <li>an <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages">options page</a> is a page that's shown when the user accesses your add-on's preferences in the browser's native add-ons manager.</li> +</ul> + +<p>For each of these components, you create an HTML file and point to it using a specific property in <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a>. The HTML file can include CSS and JavaScript files, just like a normal web page.</p> + +<p>All of these are a type of <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages">Extension pages</a>, and unlike a normal web page, your JavaScript can use all the same privileged WebExtension APIs as your background script. They can even directly access variables in the background page using {{WebExtAPIRef("runtime.getBackgroundPage()")}}.</p> + +<h2 id="Extension_pages擴充頁面">Extension pages擴充頁面</h2> + +<p>You can also include HTML documents in your extension which are not attached to some predefined user interface component. Unlike the documents you might provide for sidebars, popups, or options pages, these don't have an entry in manifest.json. However, they do also get access to all the same privileged WebExtension APIs as your background script.</p> + +<p>You'd typically load a page like this using {{WebExtAPIRef("windows.create()")}} or {{WebExtAPIRef("tabs.create()")}}.</p> + +<p>See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages">Extension pages</a> to learn more.</p> + +<h2 id="Content_scripts">Content scripts</h2> + +<p>Use content scripts to access and manipulate web pages. Content scripts are loaded into web pages and run in the context of that particular page.</p> + +<p>Content scripts are extension-provided scripts which run in the context of a web page; this differs from scripts which are loaded by the page itself, including those which are provided in {{HTMLElement("script")}} elements within the page.</p> + +<p>Content scripts can see and manipulate the page's DOM, just like normal scripts loaded by the page.</p> + +<p>Unlike normal page scripts, they can:</p> + +<ul> + <li>Make cross-domain XHR requests.</li> + <li>Use a small subset of the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API">WebExtension APIs</a>.</li> + <li>Exchange messages with their background scripts and can in this way indirectly access all the WebExtension APIs.</li> +</ul> + +<p>Content scripts cannot directly access normal page scripts but can exchange messages with them using the standard <code><a href="/en-US/docs/Web/API/Window/postMessage">window.postMessage()</a></code> API.</p> + +<p>Usually, when we talk about content scripts, we are referring to JavaScript, but you can inject CSS into web pages using the same mechanism.</p> + +<p>See the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> article to learn more.</p> + +<h2 id="Web_accessible_resources_網頁無障礙資源">Web accessible resources 網頁無障礙資源</h2> + +<p>Web accessible resources are resources such as images, HTML, CSS, and JavaScript that you include in the extension and want to make accessible to content scripts and page scripts. Resources which are made web-accessible can be referenced by page scripts and content scripts using a special URI scheme.</p> + +<p>For example, if a content script wants to insert some images into web pages, you could include them in the extension and make them web accessible. Then the content script could create and append <code><a href="/en-US/docs/Web/HTML/Element/img">img</a></code> tags which reference the images via the <code>src</code> attribute.</p> + +<p>To learn more, see the documentation for the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources">web_accessible_resources</a> manifest.json key.</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/cookiestore/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/cookiestore/index.html new file mode 100644 index 0000000000..b8ab73dc3f --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/cookiestore/index.html @@ -0,0 +1,80 @@ +--- +title: cookies.CookieStore +slug: Mozilla/Add-ons/WebExtensions/API/cookies/CookieStore +translation_of: Mozilla/Add-ons/WebExtensions/API/cookies/CookieStore +--- +<div>{{AddonSidebar()}}</div> + +<p>{{WebExtAPIRef("cookies")}} API 的 <code>CookieStore</code> 型別代表瀏覽器中的 cookie 存放空間。</p> + +<p>不同瀏覽模式(browsing mode)的視窗,有不同的 cookie 存放空間:例如隱私/隱身模式的視窗,會使用來自非隱私/隱身模式視窗的個別 cookie 存放空間。</p> + +<h2 id="型別">型別</h2> + +<p>此型別的值都是物件,並包含以下屬性:</p> + +<dl class="reference-values"> + <dt><code>id</code></dt> + <dd><code>string</code>,代表 cookie 存放空間內的唯一識別號(identifier)。</dd> + <dt><code>tabIds</code></dt> + <dd><code>integers</code> 的 <code>array</code>,識別所有分享此 cookie 存放空間的瀏覽頁籤。</dd> +</dl> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.api.cookies.CookieStore")}}</p> + +<h2 id="示例">示例</h2> + +<p>在以下程式碼片段內,{{WebExtAPIRef("cookies.getAllCookieStores()")}} 用來查找瀏覽器內,所有目前能用 cookie 存放空間,並列出每個 cookie 存放空間的 ID、還有分享此 cookie 存放空間的頁籤。</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">logStores</span><span class="punctuation token">(</span>cookieStores<span class="punctuation token">)</span> <span class="punctuation token">{</span> + <span class="keyword token">for</span><span class="punctuation token">(</span>store <span class="keyword token">of</span> cookieStores<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="template-string token"><span class="string token">`Cookie store: </span><span class="interpolation token"><span class="interpolation-punctuation punctuation token">${</span>store<span class="punctuation token">.</span>id<span class="interpolation-punctuation punctuation token">}</span></span><span class="string token">\n Tab IDs: </span><span class="interpolation token"><span class="interpolation-punctuation punctuation token">${</span>store<span class="punctuation token">.</span>tabIds<span class="interpolation-punctuation punctuation token">}</span></span><span class="string token">`</span></span><span class="punctuation token">)</span><span class="punctuation token">;</span> + <span class="punctuation token">}</span> +<span class="punctuation token">}</span> + +<span class="keyword token">var</span> getting <span class="operator token">=</span> browser<span class="punctuation token">.</span>cookies<span class="punctuation token">.</span><span class="function token">getAllCookieStores</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +getting<span class="punctuation token">.</span><span class="function token">then</span><span class="punctuation token">(</span>logStores<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>致謝</strong> + +<p>此 API 基於 Chromium 的 <a href="https://developer.chrome.com/extensions/cookies"><code>chrome.cookies</code></a> API 而來,文件改作自 Chromium 程式碼裡的 <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/cookies.json"><code>cookies.json</code></a>。</p> + +<p>Microsoft Edge 的相容資訊來自微軟公司,原文以創用 CC 姓名標示 3.0 美國版條款授權大眾使用。</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/index.html new file mode 100644 index 0000000000..34da08932c --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/index.html @@ -0,0 +1,163 @@ +--- +title: cookies +slug: Mozilla/Add-ons/WebExtensions/API/cookies +tags: + - API + - Add-ons + - Cookies + - Extensions + - Interface + - Non-standard + - Reference + - WebExtensions + - 介面 + - 參考文件 + - 擴充套件 + - 附加元件 + - 非標準 +translation_of: Mozilla/Add-ons/WebExtensions/API/cookies +--- +<div>{{AddonSidebar}}</div> + +<div>讓擴充套件可以取得、設定 cookies 資訊,並監控其變動。</div> + +<div> </div> + +<p>使用此 API 前,必須先在 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json </a>檔案中加入「cookies」這項 <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#API_permissions">API 權限宣告</a>,也必須以 <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#Host_permissions">host 權限宣告</a>將要存取 Cookies 的網站列入。參見 <a href="/en-US/Add-ons/WebExtensions/API/cookies#Permissions">Cookie 權限</a>一節。</p> + +<h2 id="型別">型別</h2> + +<dl> + <dt>{{WebExtAPIRef("cookies.Cookie")}}</dt> + <dd>代表一個 HTTP cookie 的相關資訊。</dd> + <dt>{{WebExtAPIRef("cookies.CookieStore")}}</dt> + <dd>代表瀏覽器中的 cookie 存放空間。</dd> + <dt>{{WebExtAPIRef("cookies.OnChangedCause")}}</dt> + <dd>代表觸發 cookie 資料變動的原因。</dd> +</dl> + +<h2 id="方法">方法</h2> + +<dl> + <dt>{{WebExtAPIRef("cookies.get()")}}</dt> + <dd>取回單一 cookie 的相關資訊。</dd> + <dt>{{WebExtAPIRef("cookies.getAll()")}}</dt> + <dd>取回符合設定條件的所有 cookies 資訊。</dd> + <dt>{{WebExtAPIRef("cookies.set()")}}</dt> + <dd>為 cookie 設定資料。如果目前已有相同的 cookies,則會覆寫原本的 cookie 資料。</dd> + <dt>{{WebExtAPIRef("cookies.remove()")}}</dt> + <dd>刪除某特定名稱的 cookie。</dd> + <dt>{{WebExtAPIRef("cookies.getAllCookieStores()")}}</dt> + <dd>列出目前所有的 cookie 存放空間。</dd> +</dl> + +<h2 id="事件處理程序">事件處理程序</h2> + +<dl> + <dt>{{WebExtAPIRef("cookies.onChanged")}}</dt> + <dd>當 cookie 設定或刪除時觸發。</dd> +</dl> + +<h2 id="權限">權限</h2> + +<p>使用此 API 前,擴充套件應於 manifest.json 設定檔中指明需要「cookies」<a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#API_permissions">API 權限</a>,亦須以 <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#Host_permissions">host 權限宣告</a>指明需要存取 cookies 的網站清單。此後,符合 host 權限宣告的 URL 所能讀寫的任何 cookies,該擴充套件即可讀取。比方說:</p> + +<dl> + <dt><code>http://*.example.com/</code></dt> + <dd> + <p>若套件有這樣的 host 權限宣告,即可:</p> + + <ul> + <li>讀取 <code>www.example.com</code> 任何路徑下的非安全 cookie。</li> + <li>寫入 <code>www.example.com</code> 任何路徑下的安全或非安全 cookie。</li> + </ul> + + <p>但<em>不能</em>:</p> + + <ul> + <li>讀取 <code>www.example.com</code> 下的安全 cookie。</li> + </ul> + </dd> + <dt><code>http://www.example.com/</code></dt> + <dd> + <p>若套件有這樣的 host 權限宣告,即可:</p> + + <ul> + <li>讀取 <code>www.example.com</code> 任何路徑下的非安全 cookie。</li> + <li>讀取 <code>.example.com</code> 任何路徑下的非安全 cookie。</li> + <li>寫入 <code>www.example.com</code> 任何路徑下的安全或非安全 cookie。</li> + <li>寫入 <code>.example.com</code> 任何路徑下的安全或非安全 cookie。</li> + </ul> + + <p>但<em>不能</em>:</p> + + <ul> + <li>寫入 <code>foo.example.com</code> 的 cookie。</li> + <li>寫入 <code>foo.www.example.com</code> 的 cookie。</li> + </ul> + </dd> + <dt><code>*://*.example.com/</code></dt> + <dd> + <p>若套件有這樣的 host 權限宣告,即可:</p> + + <ul> + <li>讀、寫 <code>www.example.com</code> 任何路徑下的安全或非安全 cookie。</li> + </ul> + </dd> +</dl> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p>{{Compat("webextensions.api.cookies")}}</p> + +<div class="hidden note"> +<p>The "Chrome incompatibilities" section is included from <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities"> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a> using the <a href="/en-US/docs/Template:WebExtChromeCompat">WebExtChromeCompat</a> macro.</p> + +<p>If you need to update this content, edit <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities">https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a>, then shift-refresh this page to see your changes.</p> + +<p>譯者按:該文件會持續更新,不建議翻譯。</p> +</div> + +<h3 id="Edge_不相容資訊">Edge 不相容資訊</h3> + +<p>Edge 不支援 promises,請使用回呼(callback)函式處理。</p> + +<p> {{WebExtExamples("h2")}}</p> + +<div class="note"><strong>致謝</strong> + +<p>此 API 基於 Chromium 的 <a href="https://developer.chrome.com/extensions/cookies"><code>chrome.cookies</code></a> API 而來,文件改作自 Chromium 程式碼裡的 <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/cookies.json"><code>cookies.json</code></a>。</p> + +<p>Microsoft Edge 的相容資訊來自微軟公司,原文以創用 CC 姓名標示 3.0 美國版條款授權大眾使用。</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/onchanged/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/onchanged/index.html new file mode 100644 index 0000000000..7558105bcc --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/onchanged/index.html @@ -0,0 +1,118 @@ +--- +title: cookies.onChanged +slug: Mozilla/Add-ons/WebExtensions/API/cookies/onChanged +translation_of: Mozilla/Add-ons/WebExtensions/API/cookies/onChanged +--- +<div>{{AddonSidebar()}}</div> + +<p>{{WebExtAPIRef("cookies")}} API 的 <code>onChanged</code> 事件會在 cookie 設定或刪除時觸發。</p> + +<p>請注意,更新 cookie 的屬性要透過以下兩個步驟實做:</p> + +<ol> + <li>首先,要更新的 cookie 會先被刪掉,並產生一個 <code>overwrite</code> 的 {{WebExtAPIRef("cookies.OnChangedCause")}} 提醒。</li> + <li>接著,帶著更新數值的新 cookie 會被寫進去,並產生第二個 <code>explicit</code> 的 {{WebExtAPIRef("cookies.OnChangedCause")}} 提醒。</li> +</ol> + +<h2 id="語法">語法</h2> + +<pre class="syntaxbox brush:js">browser.cookies.onChanged.addListener(listener) +browser.cookies.onChanged.removeListener(listener) +browser.cookies.onChanged.hasListener(listener) +</pre> + +<p>此 API 也能以 <code>browser.cookies.onChanged.*</code> 運行。</p> + +<p>此事件有以下函式:</p> + +<dl> + <dt><code>addListener(callback)</code></dt> + <dd>給此事件添加監聽器(listener)。</dd> + <dt><code>removeListener(listener)</code></dt> + <dd>停止監聽此事件。<code>listener</code> 參數是要移除的監聽器。</dd> + <dt><code>hasListener(listener)</code></dt> + <dd>檢查此事件的 <code>listener</code> 是否被監聽了。若有監聽,回傳 <code>true</code>,否則回傳 <code>false</code>。</dd> +</dl> + +<h2 id="addListener_語法">addListener 語法</h2> + +<h3 id="參數">參數</h3> + +<dl> + <dt><code>callback</code></dt> + <dd> + <p>能被呼叫的 callback 函式會在此事件發生的時候觸發。函式會 passed 以下參數:</p> + + <dl class="reference-values"> + <dt><code>changeInfo</code></dt> + <dd>一個含有觸發事件資訊的 <code>object</code>。它有兩個屬性:</dd> + <dd> + <dl class="reference-values"> + <dt><code>removed</code></dt> + <dd>一個 <code>boolean</code>。如果 cookie 被刪除則為 <code>true</code>,否則為 <code>false</code>。</dd> + <dt><code>cookie</code></dt> + <dd>一個 {{WebExtAPIRef('cookies.Cookie')}} 物件。含有被設定、或被刪除的 cookie 資訊。</dd> + <dt><code>cause</code></dt> + <dd>一個 {{WebExtAPIRef('cookies.OnChangedCause')}} 數值。含有 cookie被改變的潛在原因。</dd> + </dl> + </dd> + </dl> + </dd> +</dl> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p class="hidden">本相容性表格由結構化資料產生。若要貢獻資料,請參考 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 並給一個 pull request。</p> + +<p>{{Compat("webextensions.api.cookies.onChanged")}}</p> + +<h2 id="示例">示例</h2> + +<p>本範例監聽 <code>onChanged</code> 事件並紀錄由 <code>changeInfo</code> 參數傳來的資訊:</p> + +<pre class="brush: js line-numbers language-js">browser.cookies.onChanged.addListener(function(changeInfo) { + console.log('Cookie changed: ' + + '\n * Cookie: ' + JSON.stringify(changeInfo.cookie) + + '\n * Cause: ' + changeInfo.cause + + '\n * Removed: ' + changeInfo.removed); +});</pre> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>致謝</strong> + +<p>此 API 基於 Chromium 的 <a href="https://developer.chrome.com/extensions/cookies"><code>chrome.cookies</code></a> API 而來,文件改作自 Chromium 程式碼裡的 <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/cookies.json"><code>cookies.json</code></a>。</p> + +<p>Microsoft Edge 的相容資訊來自微軟公司,原文以創用 CC 姓名標示 3.0 美國版條款授權大眾使用。</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/onchangedcause/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/onchangedcause/index.html new file mode 100644 index 0000000000..592aaf7d6d --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/cookies/onchangedcause/index.html @@ -0,0 +1,82 @@ +--- +title: cookies.OnChangedCause +slug: Mozilla/Add-ons/WebExtensions/API/cookies/OnChangedCause +translation_of: Mozilla/Add-ons/WebExtensions/API/cookies/OnChangedCause +--- +<div>{{AddonSidebar()}}</div> + +<p>{{WebExtAPIRef("cookies")}} API 的 <code>OnChangedCause</code> 型別,代表觸發 cookie 資料變動的原因。</p> + +<h2 id="型別">型別</h2> + +<p>此型別的所有值都是字串(string)。可用值包括:</p> + +<dl> + <dt><code>evicted</code></dt> + <dd>由於垃圾回收(garbage collection)而被刪除的 cookie。</dd> + <dt><code>expired</code></dt> + <dd>由於過期而被刪除的 cookie。</dd> + <dt><code>explicit</code></dt> + <dd>透過顯式呼叫(explicit call){{WebExtAPIRef("cookies.remove()")}} 而被插入或刪除的 cookie。</dd> + <dt><code>expired_overwrite</code></dt> + <dd>被已過期(already-expired expiration date)cookie 所覆寫的 cookie。</dd> + <dt><code>overwrite</code></dt> + <dd>A call to {{WebExtAPIRef("cookies.set()")}} overwrote this cookie with a different one.</dd> +</dl> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.api.cookies.OnChangedCause")}}</p> + +<h2 id="示例">示例</h2> + +<p>你可以在 cookie 變更的時候監聽被通知的 {{WebExtAPIRef("cookies.onChanged")}} 事件。此監聽器 passed 含有 <code>cause</code> 屬性,值為 <code>OnChangeCaused</code> 字串的 <code>changeInfo</code> 物件:</p> + +<pre class="brush: js">browser.cookies.onChanged.addListener(function(changeInfo) { + console.log('Cookie changed: ' + + '\n * Cookie: ' + JSON.stringify(changeInfo.cookie) + + '\n * Cause: ' + changeInfo.cause + + '\n * Removed: ' + changeInfo.removed); +});</pre> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>致謝</strong> + +<p>此 API 基於 Chromium 的 <a href="https://developer.chrome.com/extensions/cookies"><code>chrome.cookies</code></a> API 而來,文件改作自 Chromium 程式碼裡的 <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/cookies.json"><code>cookies.json</code></a>。</p> + +<p>Microsoft Edge 的相容資訊來自微軟公司,原文以創用 CC 姓名標示 3.0 美國版條款授權大眾使用。</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/index.html new file mode 100644 index 0000000000..955086de10 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/index.html @@ -0,0 +1,53 @@ +--- +title: JavaScript APIs +slug: Mozilla/Add-ons/WebExtensions/API +tags: + - NeedsTranslation + - TopicStub + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/API +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>JavaScript APIs for WebExtensions can be used inside the extension's <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">background scripts</a> and in any other documents bundled with the extension, including <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a> or <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Page_actions">page action</a> popups, <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Sidebars">sidebars</a>, <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Options_pages">options pages</a>, or <a href="/en-US/Add-ons/WebExtensions/manifest.json/chrome_url_overrides">new tab pages</a>. A few of these APIs can also be accessed by an extension's <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Content_scripts">content scripts</a> (see the <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#WebExtension_APIs">list in the content script guide</a>).</p> + +<p>To use the more powerful APIs you need to <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions">request permission</a> in your extension's manifest.json.</p> + +<p>You can access the APIs using the <code>browser</code> namespace:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">logTabs</span><span class="punctuation token">(</span>tabs<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span>tabs<span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> + +browser<span class="punctuation token">.</span>tabs<span class="punctuation token">.</span><span class="function token">query</span><span class="punctuation token">(</span><span class="punctuation token">{</span>currentWindow<span class="punctuation token">:</span> <span class="keyword token">true</span><span class="punctuation token">}</span><span class="punctuation token">,</span> logTabs<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> +</div> + +<div> +<p>Many of the APIs are asynchronous, returning a <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">logCookie</span><span class="punctuation token">(</span>c<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span>c<span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> + +<span class="keyword token">function</span> <span class="function token">logError</span><span class="punctuation token">(</span>e<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">error</span><span class="punctuation token">(</span>e<span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> + +<span class="keyword token">var</span> setCookie <span class="operator token">=</span> browser<span class="punctuation token">.</span>cookies<span class="punctuation token">.</span><span class="keyword token">set</span><span class="punctuation token">(</span> + <span class="punctuation token">{</span>url<span class="punctuation token">:</span> <span class="string token">"https://developer.mozilla.org/"</span><span class="punctuation token">}</span> +<span class="punctuation token">)</span><span class="punctuation token">;</span> +setCookie<span class="punctuation token">.</span><span class="function token">then</span><span class="punctuation token">(</span>logCookie<span class="punctuation token">,</span> logError<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> +</div> + +<div> +<p>Note that this is different from Google Chrome's extension system, which uses the <code>chrome</code> namespace instead of <code>browser</code>, and which uses callbacks instead of promises for asynchronous functions. As a porting aid, the Firefox implementation of WebExtensions APIs supports <code>chrome</code> and callbacks as well as <code>browser</code> and promises. Mozilla has also written a polyfill which enables code that uses <code>browser</code> and promises to work unchanged in Chrome: <a class="external external-icon" href="https://github.com/mozilla/webextension-polyfill">https://github.com/mozilla/webextension-polyfill</a>.</p> + +<p>Firefox also implements these APIs under the <code>chrome</code> namespace using callbacks. This allows code written for Chrome to run largely unchanged in Firefox for the APIs documented here.</p> + +<p>Microsoft Edge uses the <code>browser</code> namespace, but doesn't yet support promise-based asynchronous APIs. In Edge, for the time being, asynchronous APIs must use callbacks.</p> + +<p>Not all browsers support all the APIs: for the details, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs">Browser support for JavaScript APIs</a>.</p> +</div> + +<div>{{SubpagesWithSummaries}}</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/storage/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/index.html new file mode 100644 index 0000000000..8e1d68894d --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/index.html @@ -0,0 +1,103 @@ +--- +title: storage +slug: Mozilla/Add-ons/WebExtensions/API/storage +tags: + - API + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/API/storage +--- +<div> +<div>{{AddonSidebar}}</div> + +<p>讓套件可以存讀資料以及監聽儲存項目的更動。</p> + +<p>儲存系統基於 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API">Web Storage API</a>,有一些不同,包括:</p> + +<ul> + <li>非同步</li> + <li>值的作用域在套件而不是某個特定的網域(後端的所有腳本與內容腳本都可用同樣的鍵值)。</li> + <li>儲存的值可以是任何的 JSON-ifiable 值而並非只能是 <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>。這包括了: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">陣列</a></code>、<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">物件</a></code>。但只有在內容可以被以JSON表示的時候,這表示不包含DOM節點。你不需要特地把值轉爲JSON <code>Strings</code>來儲存它們,它們在內部就是以JSON來表示的。</li> + <li>同一個API呼叫中可以設置或取得複數鍵值。</li> +</ul> + +<p>要使用這個 API 你必須在 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> 裡面加入 "storage" 的<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">權限</a>。</p> + +<p>每個套件都有自己的儲存空間,它們可以被切分爲不同種類的儲存。</p> + +<p>雖然這個 API 與{{domxref("Window.localStorage")}}很相似,建議你不要在套件裡使用 <code>Window.localStorage</code> 儲存套件相關資料。Firefox 在用戶由於隱私問題清除歷史記錄與資料時會清除 localStorage API 儲存的資料,而 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local">storage.local</a></code> API 儲存的則會留著。</p> + +<div class="note">儲存空間不會被加密,所以你不應該把它們用來儲存用戶的機密資料。</div> + +<h2 id="型別">型別</h2> + +<dl> + <dt>{{WebExtAPIRef("storage.StorageArea")}}</dt> + <dd>表示儲存空間的物件。</dd> + <dt>{{WebExtAPIRef("storage.StorageChange")}}</dt> + <dd>表示儲存空間變化的物件。</dd> +</dl> + +<h2 id="屬性">屬性</h2> + +<p><code>storage</code> 有三個屬性,各自表示不同種類的儲存空間。</p> + +<dl> + <dt>{{WebExtAPIRef("storage.sync")}}</dt> + <dd>表示 <code>sync</code> 儲存空間。<code>sync</code> 儲存空間裡的項目會被瀏覽器同步,所以可以跨裝置在所有已登入瀏覽器實例裡面使用。</dd> + <dt>{{WebExtAPIRef("storage.local")}}</dt> + <dd>表示 <code>local</code> 儲存空間。<code>local</code> 儲存空間裡的項目會被侷限在安裝套件的機器上。</dd> + <dt>{{WebExtAPIRef("storage.managed")}}</dt> + <dd>表示 <code>managed</code> 儲存空間。<code>managed</code> 儲存空間的項目由網域管理者設置而且對套件唯讀,修改這項會導致錯誤。</dd> +</dl> + +<h2 id="事件">事件</h2> + +<dl> + <dt>{{WebExtAPIRef("storage.onChanged")}}</dt> + <dd>當儲存空間裡的一個或更多項目被修改時觸發。</dd> +</dl> + +<h2 id="瀏覽器兼容性">瀏覽器兼容性</h2> +</div> + +<p>{{Compat("webextensions.api.storage")}}</p> + +<p>{{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Acknowledgements</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/storage"><code>chrome.storage</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/extensions/common/api/storage.json"><code>storage.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/storage/local/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/local/index.html new file mode 100644 index 0000000000..3cdc3ab140 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/local/index.html @@ -0,0 +1,84 @@ +--- +title: storage.local +slug: Mozilla/Add-ons/WebExtensions/API/storage/local +translation_of: Mozilla/Add-ons/WebExtensions/API/storage/local +--- +<div>{{AddonSidebar()}}</div> + +<p>代表 <code>local</code> 儲存空間。通常 <code>local</code> 裡面的東西,會放在套件安裝的地方。</p> + +<p>瀏覽器可能會限制套件本地可儲存的資料數量:</p> + +<ul> + <li>Chrome 限制套件內用到此 API 資料的上限為 5MB,除非有 <a href="/zh-TW/Add-ons/WebExtensions/manifest.json/permissions#Unlimited_storage">unlimitedStorage</a> 權限。</li> + <li>56 版以後的 Firefox 將能要求 unlimitedStorage 權限。目前 Firefox 還沒有限制套件內的資料上限,但這功能會在未來引入:因此,如果可能會儲存大容量的資料,最好要實做 unlimitedStorage 的請求。</li> +</ul> + +<p>如果套件被移除、相關的儲存資料也會一併移除。</p> + +<p>在 Firefox 內,你可以透過 about:config 內設定 keepUuidOnUninstall 與 keepStorageOnUninstall 為 <code>true</code> 以避免瀏覽器在移除套件時,一併移除相關的儲存資料。這個功能是為了方便開發者除錯,套件本身無法改變這個設定。</p> + +<p>雖然這 API 與 {{domxref("Window.localStorage")}} 相似,但不建議在套件內使用 <code>Window.localStorage</code>。在某些情況下,用戶會出於隱私上的理由,要求 Firefox 清理瀏覽紀錄與資料,這其中就包含使用 localStorage API 的資料。另一方面,storage.local API 的資料,在這種情況下會予以保留。</p> + +<h2 id="方法">方法</h2> + +<p><code>local</code> 物件實做了定義於 {{WebExtAPIRef("storage.StorageArea")}} 類別的方法:</p> + +<dl> + <dt>{{WebExtAPIRef("storage.StorageArea.get()")}}</dt> + <dd>取得一個或多個源自儲存空間的項目。</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.getBytesInUse()")}}</dt> + <dd>取得儲存空間內,一個或多個已為項目所使用的容量。單位為 byte。</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.set()")}}</dt> + <dd>Stores one or more items in the storage area. If the item already exists, its value will be updated. When you set a value, the {{WebExtAPIRef("storage.onChanged")}} event will fire.</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.remove()")}}</dt> + <dd>刪除一個或多個儲存空間內的項目。</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.clear()")}}</dt> + <dd>刪除所有儲存空間內的項目。</dd> +</dl> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.api.storage.local")}}</p> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>致謝</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/storage#property-local"><code>chrome.storage</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/extensions/common/api/storage.json"><code>storage.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.html new file mode 100644 index 0000000000..744cc6ed8b --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.html @@ -0,0 +1,122 @@ +--- +title: StorageArea.get() +slug: Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/get +translation_of: Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/get +--- +<div>{{AddonSidebar()}}</div> + +<p>從儲存空間內檢查一個或多個單元(item)。</p> + +<p>這個非同步函式會回傳 <code><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>。</p> + +<h2 id="語法">語法</h2> + +<pre class="syntaxbox">let gettingItem = browser.storage.<storageType>.get( + keys // null, string, object or array of strings +) +</pre> + +<p><code><storageType></code> 會是以下可覆寫的儲存類型之一:{{WebExtAPIRef("storage.sync")}} 或 {{WebExtAPIRef("storage.local")}}。</p> + +<h3 id="參數">參數</h3> + +<dl> + <dt><code>keys</code></dt> + <dd>用來識別要檢查單元的 key(單個為字串;多個為陣列、或指定預設值的物件)。如果把這裡留空(空字串、空陣列、空物件都可以),就會取得空物件。如果是 <code>null</code> 或 undefined,則會取得所有儲存的內容。</dd> +</dl> + +<h3 id="回傳值">回傳值</h3> + +<p><code><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code> that will be fulfilled with a <code>results</code> object containing every object in <code>keys</code> that was found in the storage area. If the operation failed, the promise will be rejected with an error message.</p> + +<div class="warning"> +<p>When used within a content script in Firefox versions prior to 52, the Promise returned by <code>browser.storage.local.get()</code> is fulfilled with an Array containing one Object. The Object in the Array contains the <code>keys</code> found in the storage area, as described above. The Promise is correctly fulfilled with an Object when used in the background context (background scripts, popups, options pages, etc.). When this API is used as <code>chrome.storage.local.get()</code>, it correctly passes an Object to the callback function.</p> +</div> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p>{{Compat("webextensions.api.storage.StorageArea.get")}}</p> + +<h2 id="示例">示例</h2> + +<p>假設儲存空間有以下單元:</p> + +<pre class="brush: js">// 兩個單元:「kitten」與「monster」 +browser.storage.local.set({ + kitten: {name:"Mog", eats:"mice"}, + monster: {name:"Kraken", eats:"people"} +});</pre> + +<p>Define success and failure handlers for the promise:</p> + +<pre class="brush: js">function onGot(item) { + console.log(item); +} + +function onError(error) { + console.log(`Error: ${error}`); +}</pre> + +<p>With no <code>keys</code> argument, retrieve everything:</p> + +<pre class="brush: js">let gettingItem = browser.storage.local.get(); +gettingItem.then(onGot, onError); + +// -> Object { kitten: Object, monster: Object }</pre> + +<p>With an empty keys argument, return nothing:</p> + +<pre class="brush: js">// with an empty array, retrieve nothing +let gettingItem = browser.storage.local.get([]); +gettingItem.then(onGot, onError); + +// -> Object { }</pre> + +<p>With the name of an object, retrieve the match:</p> + +<pre class="brush: js">let gettingItem = browser.storage.local.get("kitten"); +gettingItem.then(onGot, onError); + +// -> Object { kitten: Object }</pre> + +<p>With an array of object names, retrieve all matches:</p> + +<pre class="brush: js">let gettingItem = browser.storage.local.get(["kitten", "monster", "grapefruit"]); +gettingItem.then(onGot, onError); + +// -> Object { kitten: Object, monster: Object } </pre> + +<p>With an object with object names as keys and the default value as value:</p> + +<pre class="brush: js">let gettingItem = browser.storage.local.get({ + kitten: "no kitten", + monster: "no monster", + grapefruit: { + name: "Grape Fruit", + eats: "Water" + } +}); + +// -> Object { kitten: Object, monster: Object, grapefruit: Object } +</pre> + +<p>{{WebExtExamples}}</p> + +<h3 id="Chrome_示例">Chrome 示例</h3> + +<pre class="brush: js">chrome.storage.local.get("kitten", function(items){ + console.log(items.kitten); // -> {name:"Mog", eats:"mice"} +});</pre> + +<p class="brush: js">Or with an arrow function</p> + +<pre class="brush: js">chrome.storage.local.get("kitten", items=>{ + console.log(items.kitten); // -> {name:"Mog", eats:"mice"} +});</pre> + +<div class="note"><strong>致謝</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/storage"><code>chrome.storage</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/extensions/common/api/storage.json"><code>storage.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/api/storage/storagearea/index.html b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/storagearea/index.html new file mode 100644 index 0000000000..088e8b5a79 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/api/storage/storagearea/index.html @@ -0,0 +1,85 @@ +--- +title: storage.StorageArea +slug: Mozilla/Add-ons/WebExtensions/API/storage/StorageArea +tags: + - API + - Add-ons + - Extensions + - NeedsTranslation + - Non-standard + - Reference + - Storage + - StorageArea + - TopicStub + - Type + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/API/storage/StorageArea +--- +<div>{{AddonSidebar()}}</div> + +<p>StorageArea is an object representing a storage area.</p> + +<h2 id="Type">Type</h2> + +<p>Values of this type are objects.</p> + +<h2 id="Methods">Methods</h2> + +<dl> + <dt>{{WebExtAPIRef("storage.StorageArea.get()")}}</dt> + <dd>Retrieves one or more items from the storage area.</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.getBytesInUse()")}}</dt> + <dd>Gets the amount of storage space (in bytes) used one or more items being stored in the storage area.</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.set()")}}</dt> + <dd>Stores one or more items in the storage area. If an item already exists, its value will be updated.</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.remove()")}}</dt> + <dd>Removes one or more items from the storage area.</dd> + <dt>{{WebExtAPIRef("storage.StorageArea.clear()")}}</dt> + <dd>Removes all items from the storage area.</dd> +</dl> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.api.storage.StorageArea")}}</p> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>Acknowledgements</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/storage#type-StorageArea"><code>chrome.storage</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/extensions/common/api/storage.json"><code>storage.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/content_scripts/index.html b/files/zh-tw/mozilla/add-ons/webextensions/content_scripts/index.html new file mode 100644 index 0000000000..e767b3ef89 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/content_scripts/index.html @@ -0,0 +1,444 @@ +--- +title: 內容腳本 +slug: Mozilla/Add-ons/WebExtensions/Content_scripts +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/Content_scripts +--- +<div>{{AddonSidebar}}</div> + +<div>內容腳本(content script)是擴充套件的一部分,它會在在特定的網頁執行(與之相對的則是同樣屬於套件</div> + +<div>的後端腳本(background scripts)或者網站本身的腳本,像是那些那些透過 {{HTMLElement("script")}} 標籤讀取的內</div> + +<div>容)</div> + +<div> </div> + +<p><a href="/en-US/Add-ons/WebExtensions/Background_scripts">後端腳本</a>可以使用所有的 <a href="/en-US/Add-ons/WebExtensions/API">擴充套件JavaScript APIs</a>,但它們無法直接使用網頁中的內容。所以如果你的套件必須要透過 content scripts 才能使用它們。</p> + +<p>就像一般網頁裡的 scripts 一樣,content scripts 可以透過 standard DOM APIs 存取並修改頁面內容。</p> + +<p>Content scripts 只能使用can only access <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#WebExtension_APIs">一小部分的擴充套件APIs</a>,但它們可以透過一個訊息系統<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts">來與後端腳本溝通</a>,從而間接地使用擴充套件APIs。</p> + +<div class="note"> +<p>留意到 content scripts 目前會在 addons.mozilla.org 和 testpilot.firefox.com 中被阻擋。如果你嘗試在這些網域下的頁面注入一段 content script 會失敗並且在日誌裡記下一個 <a href="/en-US/docs/Web/HTTP/CSP">CSP</a> 錯誤。</p> +</div> + +<div class="note"> +<p>由於錯誤 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1408996">1408996</a>,透過 <code>var foo</code> or <code>window.foo = "bar"</code> 加入 content script 的 global 作用域的值可能會消失。</p> +</div> + +<h2 id="讀入內容腳本">讀入內容腳本</h2> + +<p>你可以透過下列三種方式將內容腳本讀入頁面:</p> + +<ol> + <li><strong>在安裝時讀入至符合URL模式的頁面:</strong>透過你的 manifest.json 中的 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code> 鍵,你可以要求瀏覽器在每次讀取URL<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns">符合給定模式</a>的頁面時讀入內容腳本。</li> + <li><strong>在執行時讀入至符合URL模式的頁面:</strong>透過 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code> API,你可以要求瀏覽器在每次讀取URL<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns">符合給定模式</a>的頁面時讀入內容腳本。這就像第一種方法,不同的是你可以在執行時增加或移除內容腳本。</li> + <li><strong>在執行時讀入至特定的頁籤:透過</strong> <code><a href="/en-US/Add-ons/WebExtensions/API/Tabs/executeScript">tabs.executeScript()</a></code> API,你可以在任何時候將內容腳本讀入特定的頁籤:舉例來說可以在使用者點擊<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">工具列按鈕</a>時給予回應。</li> +</ol> + +<p>每個套件的每個架構裡都只有一個全局作用域,所以一個內容腳本的變數可以直接被其他內容腳本使用,不管那個內容腳本是怎麼被讀入的。</p> + +<p>透過方法(1)和方法(2)你只能把內容腳本讀入至URL可以用<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns">匹配模式</a>來呈現的頁面中。而透過方法3可以把腳本讀入與套件打包在一起的頁面之中,但是你不能在像是 "about:debugging" 或 "about:addons" 這類特別的瀏覽器頁面讀入腳本。</p> + +<h2 id="內容腳本環境">內容腳本環境</h2> + +<h3 id="使用_DOM">使用 DOM</h3> + +<p>內容腳本可以像一般頁面的腳本一樣使用並修改頁面的DOM。它們也可以偵測到所有頁面script 對 DOM 做的更動。</p> + +<p>然而,內容腳本看到的是「乾淨的DOM」。這表示:</p> + +<ul> + <li>內容腳本看不見頁面腳本的 Javascript 變數</li> + <li>如果頁面腳本修改了原有DOM的屬性,內容腳本會看見原來的屬性而非被修改過的。</li> +</ul> + +<p>在 Gecko 裡,這種行爲稱爲 <a href="/en-US/docs/Xray_vision">X光視野</a>。</p> + +<p>舉例來說,有這樣一個網頁:</p> + +<pre class="brush: html"><!DOCTYPE html> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + </head> + + <body> + <script src="page-scripts/page-script.js"></script> + </body> +</html></pre> + +<p>"page-script.js" 做了這件事:</p> + +<pre class="brush: js">// page-script.js + +// 替DOM新增一個元素 +var p = document.createElement("p"); +p.textContent = "This paragraph was added by a page script."; +p.setAttribute("id", "page-script-para"); +document.body.appendChild(p); + +// 替 window 定義一個新的屬性 +window.foo = "This global variable was added by a page script"; + +// 重新定義內建的 window.confirm 函數 +window.confirm = function() { + alert("The page script has also redefined 'confirm'"); +}</pre> + +<p>接著、一個套件把 content script 插入頁面:</p> + +<pre class="brush: js">// content-script.js + +// 可以使用與修改DOM +var pageScriptPara = document.getElementById("page-script-para"); +pageScriptPara.style.backgroundColor = "blue"; + +// 看不見 page-script 增加的屬性 +console.log(window.foo); // undefined + +// 看見的是原有的形式 +window.confirm("Are you sure?"); // 呼叫原本的 window.confirm()</pre> + +<p>反過來也是一樣,頁面腳本無法看到內容腳本增加的 Javascript 屬性。</p> + +<p>這表示我們可以預期內容腳本依賴著DOM屬性,不需要擔心它的變數與頁面腳本中所定義的變數衝突。</p> + +<p>這實際的影響就是內容腳本無法使用所有頁面腳本讀入的函式庫。所以,舉例來說,如果頁面包含了 JQuery,內容腳本將無法看到它。</p> + +<p>如果內容腳本真的想要使用 javascript 函式庫,那麼函式庫本身必須要與要使用它的內容腳本一同插入:</p> + +<pre class="brush: json">"content_scripts": [ + { + "matches": ["*://*.mozilla.org/*"], + "js": ["jquery.js", "content-script.js"] + } +]</pre> + +<p>注意到 Firefox 提供了一些API來使用被頁面腳本產生的 Javascript 物件以及對頁面腳本公開自己的 Javascript 物件。詳閱<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts">與頁面腳本共用物件</a>。</p> + +<h3 id="擴充套件APIs">擴充套件APIs</h3> + +<p>除標準DOM APIs之外,內容腳本可以使用下列 擴充套件APIs:</p> + +<p>來自 <code><a href="/en-US/Add-ons/WebExtensions/API/extension">extension</a></code>:</p> + +<ul> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/extension#getURL()">getURL()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/extension#inIncognitoContext">inIncognitoContext</a></code></li> +</ul> + +<p>來自 <code><a href="/en-US/Add-ons/WebExtensions/API/runtime">runtime</a></code>:</p> + +<ul> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#connect()">connect()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#getManifest()">getManifest()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#getURL()">getURL()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#onConnect">onConnect</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#onMessage">onMessage</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#sendMessage()">sendMessage()</a></code></li> +</ul> + +<p>來自 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n">i18n</a></code>:</p> + +<ul> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/getMessage">getMessage()</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/getAcceptLanguages">getAcceptLanguages()</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/getUILanguage">getUILanguage()</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/detectLanguage">detectLanguage()</a></code></li> +</ul> + +<p>來自 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage">storage</a></code> 的全部。</p> + +<h3 id="XHR_與_Fetch">XHR 與 Fetch</h3> + +<p>內容腳本可以透過一般的 <code><a href="/en-US/docs/Web/API/XMLHttpRequest">window.XMLHttpRequest</a></code> 與 <code><a href="/en-US/docs/Web/API/Fetch_API">window.fetch()</a></code> APIs 來發出請求。</p> + +<p>內容腳本跟套件的其他部分擁有相同的跨網域權限: 所以如果套件在 manifest.json 中透過 <code><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions">permissions</a></code> 鍵要求了某一網域的使用,那麼它的內容腳本也能使用同樣的網域。</p> + +<p>這是透過公開更多內容腳本中授權的XHR以及fetch實例來達成的。這件事情會導致標頭中不會設置 <code><a href="/en-US/docs/Web/HTTP/Headers/Origin">Origin</a></code> 與 <code><a href="/en-US/docs/Web/HTTP/Headers/Referer">Referer</a></code>的副作用,就像頁面請求自己一樣,一般會避免請求將跨來源泄露出去。從58版本號以後套件要傳送一些彷彿是頁面內容自己傳送的請求時可以改用 <code>content.XMLHttpRequest</code> 與 <code>content.fetch()</code>。對跨瀏覽器套件來說,這些事情的存在必須要能被做特徵檢測。</p> + +<h2 id="與後端腳本溝通">與後端腳本溝通</h2> + +<p>雖然內容腳本不能直接使用大部分的 擴充套件APIs,但是透過使用訊息APIs與後端腳本溝通,它們能夠間接地使用與後端腳本一樣的 APIs。</p> + +<p>後端腳本與內容腳本的溝通模式有兩種: 你可以傳送選擇性夾帶回應的一次性訊息,也可以在兩者之間建立一個長存的連線來交換訊息。</p> + +<h3 id="一次性訊息">一次性訊息</h3> + +<p>要傳送選擇性夾帶回應的一次性訊息,你可以使用下列APIs:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="row"> </th> + <th scope="col">在內容腳本處</th> + <th scope="col">在後端腳本處</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">傳訊息</th> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/runtime/sendMessage">browser.runtime.sendMessage()</a></code></td> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/Tabs/sendMessage">browser.tabs.sendMessage()</a></code></td> + </tr> + <tr> + <th scope="row">收訊息</th> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/runtime/onMessage">browser.runtime.onMessage</a></code></td> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/runtime/onMessage">browser.runtime.onMessage</a></code></td> + </tr> + </tbody> +</table> + +<p>舉例來說,有個監聽著頁面點擊事件的內容腳本。如果點擊對象是連結,它會傳送目標的URL給後端腳本:</p> + +<pre class="brush: js">// content-script.js + +window.addEventListener("click", notifyExtension); + +function notifyExtension(e) { + if (e.target.tagName != "A") { + return; + } + browser.runtime.sendMessage({"url": e.target.href}); +}</pre> + +<p>後端腳本監聽這些訊息並且透過 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/notifications">notifications</a></code> API 顯示通知:</p> + +<pre class="brush: js">// background-script.js + +browser.runtime.onMessage.addListener(notify); + +function notify(message) { + browser.notifications.create({ + "type": "basic", + "iconUrl": browser.extension.getURL("link.png"), + "title": "你點了個按鈕喲!", + "message": message.url + }); +} +</pre> + +<p>這個範例來自 GitHub上的 <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n </a>,稍微經過修改。</p> + +<h3 id="基於連線的訊息">基於連線的訊息</h3> + +<p>當你在後端腳本與內容腳本間交換大量訊息時,使用一次性連線顯得沒效率。所以另一個替代方案是是在兩者間建立一個長存的連線,透過這個連線交換訊息。</p> + +<p>兩邊都有一個 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code> 物件可以用來交換訊息。</p> + +<p>建立連線你需要:</p> + +<ul> + <li>一邊透過 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onConnect">runtime.onConnect</a></code> 監聽連線</li> + <li>另一邊呼叫 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/connect">tabs.connect()</a></code> (對內容腳本建立連線時)或 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/connect">runtime.connect()</a></code> (對後端腳本建立連線時)。這會回傳一個 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code> 物件。</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onConnect">runtime.onConnect</a></code> 監聽器傳送自己的 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code> 物件。</li> +</ul> + +<p>當兩邊都有端口後,可以透過 <code>runtime.Port.postMessage()</code> 來傳送訊息,用 <code>runtime.Port.onMessage</code> 接收訊息。</p> + +<p>舉例來說,當這讀取完成,這個內容腳本會:</p> + +<ul> + <li>連線至後端腳本,並將 <code>Port</code> 儲存在一個 <code>myPort</code> 變數</li> + <li>監聽並記錄 <code>myPort</code> 的訊息</li> + <li>當使用者點擊文件時,透過 <code>myPort</code> 傳送訊息給後端腳本</li> +</ul> + +<pre class="brush: js">// content-script.js + +var myPort = browser.runtime.connect({name:"port-from-cs"}); +myPort.postMessage({greeting: "內容腳本傳喜訊"}); + +myPort.onMessage.addListener(function(m) { + console.log("內容腳本收到來自後端腳本的訊息: "); + console.log(m.greeting); +}); + +document.body.addEventListener("click", function() { + myPort.postMessage({greeting: "它們點了網頁!"}); +});</pre> + +<p>同樣地,後端腳本會:</p> + +<ul> + <li>監聽來自內容腳本的連線請求</li> + <li>當它收到連線請求: + <ul> + <li>將端口儲存在 <code>portFromCS 這個變數</code></li> + <li>透過端口傳送訊息給內容腳本</li> + <li>開始監聽並記錄端口上的訊息</li> + </ul> + </li> + <li>當使用者點擊套件的工具列按鈕時,透過 <code>portFromCS</code> 傳送訊息給內容腳本</li> +</ul> + +<pre class="brush: js">// background-script.js + +var portFromCS; + +function connected(p) { + portFromCS = p; + portFromCS.postMessage({greeting: "嘿!內容腳本!"}); + portFromCS.onMessage.addListener(function(m) { + console.log("後端腳本收到來自內容腳本的訊息:") + console.log(m.greeting); + }); +} + +browser.runtime.onConnect.addListener(connected); + +browser.browserAction.onClicked.addListener(function() { + portFromCS.postMessage({greeting: "它們按了按鈕!"}); +}); +</pre> + +<h4 id="複數內容腳本">複數內容腳本</h4> + +<p>如果你有多個內容腳本同時在溝通,你可能會想把這些連線儲存在陣列裡面。</p> + +<p> </p> + +<ul> +</ul> + +<pre class="brush: js">// background-script.js + +var ports = [] + +function connected(p) { + ports[p.sender.tab.id] = p + //... +} + +browser.runtime.onConnect.addListener(connected) + +browser.browserAction.onClicked.addListener(function() { + ports.forEach(p => { + p.postMessage({greeting: "它們按了按鈕!"}) + }) +});</pre> + +<p> </p> + +<ul> +</ul> + +<h2 id="與網頁溝通">與網頁溝通</h2> + +<p>雖說內容腳本預設不能存取頁面腳本產生的物件,但它們可以透過DOM <code><a href="/en-US/docs/Web/API/Window/postMessage">window.postMessage</a></code> 和 <code><a href="/en-US/docs/Web/API/EventTarget/addEventListener">window.addEventListener</a></code> APIs與頁面腳本溝通。</p> + +<p>例如:</p> + +<pre class="brush: js">// page-script.js + +var messenger = document.getElementById("from-page-script"); + +messenger.addEventListener("click", messageContentScript); + +function messageContentScript() { + window.postMessage({ + direction: "from-page-script", + message: "Message from the page" + }, "*");</pre> + +<pre class="brush: js">// content-script.js + +window.addEventListener("message", function(event) { + if (event.source == window && + event.data && + event.data.direction == "from-page-script") { + alert("內容腳本收到訊息: \"" + event.data.message + "\""); + } +});</pre> + +<p>完全版的範例請<a href="https://mdn.github.io/webextensions-examples/content-script-page-script-messaging.html">查看GitHub上的示範頁面</a>並按照教學做。</p> + +<div class="warning"> +<p>注意到當你透過這個方式跟不被信任的內容腳本互動時要非常小心。套件有很強的權限,惡意網頁可以輕易地騙出這些權限。</p> + +<p>舉個簡單的例子,假設一接收訊息的內容腳本長這樣:</p> + +<pre class="brush: js">// content-script.js + +window.addEventListener("message", function(event) { + if (event.source == window && + event.data.direction && + event.data.direction == "from-page-script") { + eval(event.data.message); + } +});</pre> + +<p>如此一來頁面腳本可以使用包含內容腳本全部權限的程式碼。</p> +</div> + +<h2 id="在內容腳本中使用_eval()">在內容腳本中使用 eval()</h2> + +<p>在 Chrome 裡, <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code> 只會在內容腳本而不會在頁面腳本裡執行。</p> + +<p>在 Firefox 裡:</p> + +<ul> + <li>如果你呼叫 <code>eval()</code>,它會在內容腳本中執行</li> + <li>如果你呼叫 <code>window.eval()</code>,它會在頁面腳本中執行</li> +</ul> + +<p>例如,試想有一個內容腳本長這樣:</p> + +<pre class="brush: js">// content-script.js + +window.eval('window.x = 1;'); +eval('window.y = 2'); + +console.log(`In content script, window.x: ${window.x}`); +console.log(`In content script, window.y: ${window.y}`); + +window.postMessage({ + message: "check" +}, "*");</pre> + +<p>這段程式碼透過 <code>window.eval()</code> 和 <code>eval()</code> 建立了些變數 x 和 y 、記錄下它們的值並且傳訊息給頁面。</p> + +<p>接收訊息這邊,頁面腳本記錄下一樣的值:</p> + +<pre class="brush: js">window.addEventListener("message", function(event) { + if (event.source === window && event.data && event.data.message === "check") { + console.log(`In page script, window.x: ${window.x}`); + console.log(`In page script, window.y: ${window.y}`); + } +});</pre> + +<p>在 Chrome 裡,這會產出這樣的結果:</p> + +<pre>In content script, window.x: 1 +In content script, window.y: 2 +In page script, window.x: undefined +In page script, window.y: undefined</pre> + +<p>而在 Firefox 裡會產生這些:</p> + +<pre>In content script, window.x: undefined +In content script, window.y: 2 +In page script, window.x: 1 +In page script, window.y: undefined</pre> + +<p>這些也適用於 <code><a href="/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout">setTimeout()</a></code>、 <code><a href="/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval">setInterval()</a></code>、與 <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function()</a></code>。</p> + +<p>當在頁面執行程式碼時一定要小一萬個心,頁面的環境有可能被惡意的網頁所控制,它們可以重新定義與你互動的物件來作出一些出乎意料的行爲:</p> + +<pre class="brush: js">// page.js 重新定義 console.log + +var original = console.log; + +console.log = function() { + original(true); +} +</pre> + +<pre class="brush: js">// content-script.js 呼叫被重新定義的版本 + +window.eval('console.log(false)'); +</pre> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/index.html b/files/zh-tw/mozilla/add-ons/webextensions/index.html new file mode 100644 index 0000000000..bf6499baac --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/index.html @@ -0,0 +1,115 @@ +--- +title: 瀏覽器擴充功能 +slug: Mozilla/Add-ons/WebExtensions +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/WebExtensions +--- +<div>{{AddonSidebar}}</div> + +<p>擴充功能(extension)可以擴展和修改瀏覽器的功能。Firefox 的擴充功能是使用 WebExtension API 建立而成,這是一個開發跨瀏覽器擴充功能的系統。這個系統的大部分相容於 Google Chrome 和 Opera 的 <a class="external-icon external" href="https://developer.chrome.com/extensions">擴充功能 API</a> 與 <a href="https://browserext.github.io/browserext/">W3C Draft Community Group</a>。這些瀏覽器的擴充功能在大多數的情況下,只需要<a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/Porting_from_Google_Chrome">一點改變</a>就可以在 Firefox 或 <a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/extensions/">Microsoft Edge</a> 中執行。這個 API 也和<a href="https://developer.mozilla.org/zh-TW/Firefox/Multiprocess_Firefox">多處理程序的 Firefox</a> 完全相容。</p> + +<p>如果你有任何新點子、問題,或是需要使用 WebExtension API 來移植舊的擴充功能,你可以在 <a href="https://mail.mozilla.org/listinfo/dev-addons">dev-addons 郵件群組</a>或 <a href="https://wiki.mozilla.org/IRC">IRC</a> 上的 <a href="irc://irc.mozilla.org/extdev">#extdev</a> 找到我們。</p> + +<div class="row topicpage-table"> +<div class="section"> +<h2 id="開始入門">開始入門</h2> + +<ul> + <li><a href="/zh-TW/Add-ons/WebExtensions/What_are_WebExtensions">何謂擴充功能?</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Your_first_WebExtension">你的第一個 WebExtension</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Your_second_WebExtension">你的第二個 WebExtension</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Anatomy_of_a_WebExtension">解析 WebExtension</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Examples">WebExtension 範例</a></li> +</ul> + +<h2 id="如何……">如何……</h2> + +<ul> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Intercept_HTTP_requests">監看 HTTP 請求</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Modify_a_web_page">修改網頁</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Add_a_button_to_the_toolbar">在工作列增加按鈕</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Implement_a_settings_page">建立設定頁面</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard">和剪貼簿互動</a></li> +</ul> + +<h2 id="使用者介面">使用者介面</h2> + +<ul> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface">介紹</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_action">工具列按鈕</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">有彈出框的工具列按鈕</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Page_actions">網址列按鈕</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">有彈出框的網址列按鈕</a><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Page_actions">網址列按鈕</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Sidebars">側邊欄</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items">右鍵選單</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages">設定頁面</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Bundled_web_pages">附加頁面</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Notifications">通知</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/Omnibox">網址列建議</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels">開發者工具面板</a></li> +</ul> + +<h2 id="概念">概念</h2> + +<ul> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/API">JavaScript API 總覽</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Content_scripts">內容腳本</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Match_patterns">觸發條件</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Working_with_files">檔案控制</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Internationalization">國際化</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy">資訊安全聲明</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Native_messaging">原生溝通方式</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Using_the_devtools_APIs">使用開發工具 APIs</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/User_experience_best_practices">UX 範例</a></li> +</ul> + +<h2 id="移植">移植</h2> + +<ul> + <li><a href="/zh-TW/Add-ons/WebExtensions/Porting_from_Google_Chrome">移植 Google Chrome 的擴充功能</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Porting_a_legacy_Firefox_add-on">移植舊的 Firefox 附加元件</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Embedded_WebExtensions">嵌入式 WebExtensions</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_the_Add-on_SDK">與附加元件 SDK 比較</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">與 XUL/XPCOM 比較</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities">Chrome 衝突表</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Differences_between_desktop_and_Android">桌面版與 Android 版的差異</a></li> +</ul> + +<h2 id="Firefox_工作流程">Firefox 工作流程</h2> + +<ul> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/User_experience_best_practices">UX</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Temporary_Installation_in_Firefox">安裝</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Debugging">除錯</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Developing_WebExtensions_for_Firefox_for_Android">在 Firefox for Android 上開發</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext">開始使用 web-ext</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/web-ext_command_reference">web-ext 指令參考</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID">WebExtensions 和附加元件 ID</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Publishing_your_WebExtension">發布你的 WebExtension</a></li> +</ul> +</div> + +<div class="section"> +<h2 id="參考資料">參考資料</h2> + +<h4 id="JavaScript_APIs">JavaScript APIs</h4> + +<ul> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/API">JavaScript API 總覽</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs">JavaScript APIs 在各種瀏覽器的相容表</a></li> +</ul> + +<div class="twocolumns">{{ ListSubpages ("/zh-TW/Add-ons/WebExtensions/API") }}</div> + +<h4 id="Manifest_keys">Manifest keys</h4> + +<ul> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json 總覽</a></li> + <li><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json">manifest.json 在各種瀏覽器的相容表</a></li> +</ul> + +<div class="twocolumns">{{ ListSubpages ("/zh-TW/Add-ons/WebExtensions/manifest.json") }}</div> +</div> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/internationalization/index.html b/files/zh-tw/mozilla/add-ons/webextensions/internationalization/index.html new file mode 100644 index 0000000000..7c521177a3 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/internationalization/index.html @@ -0,0 +1,400 @@ +--- +title: Internationalization +slug: Mozilla/Add-ons/WebExtensions/Internationalization +translation_of: Mozilla/Add-ons/WebExtensions/Internationalization +--- +<div>{{AddonSidebar}}</div> + +<p><a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions">WebExtension</a> API 有個相當方便、能用於國際化的模組:<a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/API/i18n">i18n</a>。我們將在這篇文章內探索本功能,並提供實際做動的範例。專供 extensions 組建所使用的 i18n 系統 API,用法與坊間諸如 <a href="http://i18njs.com/">i18n.js</a> 的函式庫相似。</p> + +<div class="note"> +<p>本例所使用的套件:<a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> 能在 GitHub 找到。看各章節時,請配著原始碼觀看。</p> +</div> + +<h2 id="剖析國際化的套件">剖析國際化的套件</h2> + +<p>國際化套件能包含與其他套件相同的功能:<a href="/zh-TW/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">background scripts</a>、<a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a>……等。但它也擁有一些能允許在語言間切換的部份。目錄樹大概是這樣:</p> + +<ul class="directory-tree"> + <li>extension-root-directory/ + <ul> + <li>_locales + <ul> + <li>en + <ul> + <li>messages.json + <ul> + <li>English messages (strings)</li> + </ul> + </li> + </ul> + </li> + <li>de + <ul> + <li>messages.json + <ul> + <li>German messages (strings)</li> + </ul> + </li> + </ul> + </li> + <li>etc.</li> + </ul> + </li> + <li>manifest.json + <ul> + <li>locale-dependent metadata</li> + </ul> + </li> + <li>myJavascript.js + <ul> + <li>JavaScript for retrieving browser locale, locale-specific messages, etc.</li> + </ul> + </li> + <li>myStyles.css + <ul> + <li>locale-dependent CSS</li> + </ul> + </li> + </ul> + </li> +</ul> + +<p>我們將逐一探索各大新特性:章節的每個部份,都是要國際化套件時,所需遵循的步驟。</p> + +<h2 id="在__locales_提供本地化的字串">在 _locales 提供本地化的字串</h2> + +<div class="pull-aside"> +<div class="moreinfo">You can look up language subtags using the <em>Find</em> tool on the <a href="http://r12a.github.io/apps/subtags/">Language subtag lookup page</a>. Note that you need to search for the English name of the language.</div> +</div> + +<p>Every i18n system requires the provision of strings translated into all the different locales you want to support. In extensions, these are contained within a directory called <code>_locales</code>, placed inside the extension root. Each individual locale has its strings (referred to as messages) contained within a file called <code>messages.json</code>, which is placed inside a subdirectory of <code>_locales</code>, named using the language subtag for that locale's language.</p> + +<p>Note that if the subtag includes a basic language plus a regional variant, then the language and variant are conventionally separated using a hyphen: for example, "en-US". However, in the directories under <code>_locales</code>, <strong>the separator must be an underscore</strong>: "en_US".</p> + +<p>So <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n/_locales">for example, in our sample app</a> we have directories for "en" (English), "de" (German), "nl" (Dutch), and "ja" (Japanese). Each one of these has a <code>messages.json</code> file inside it.</p> + +<p>Let's now look at the structure of one of these files (<a href="https://github.com/mdn/webextensions-examples/blob/master/notify-link-clicks-i18n/_locales/en/messages.json">_locales/en/messages.json</a>):</p> + +<pre class="brush: json">{ + "extensionName": { + "message": "Notify link clicks i18n", + "description": "Name of the extension." + }, + + "extensionDescription": { + "message": "Shows a notification when the user clicks on links.", + "description": "Description of the extension." + }, + + "notificationTitle": { + "message": "Click notification", + "description": "Title of the click notification." + }, + + "notificationContent": { + "message": "You clicked $URL$.", + "description": "Tells the user which link they clicked.", + "placeholders": { + "url" : { + "content" : "$1", + "example" : "https://developer.mozilla.org" + } + } + } +}</pre> + +<p>This file is standard JSON — each one of its members is an object with a name, which contains a <code>message</code> and a <code>description</code>. All of these items are strings; <code>$URL$</code> is a placeholder, which is replaced with a substring at the time the <code>notificationContent</code> member is called by the extension. You'll learn how to do this in the {{anch("Retrieving message strings from JavaScript")}} section.</p> + +<div class="note"> +<p><strong>Note</strong>: You can find much more information about the contents of <code>messages.json</code> files in our <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/Locale-Specific_Message_reference">Locale-Specific Message reference</a>.</p> +</div> + +<h2 id="Internationalizing_manifest.json">Internationalizing manifest.json</h2> + +<p>There are a couple of different tasks to carry out to internationalize your manifest.json.</p> + +<h3 id="Retrieving_localized_strings_in_manifests">Retrieving localized strings in manifests</h3> + +<p>Your <a href="https://github.com/mdn/webextensions-examples/blob/master/notify-link-clicks-i18n/manifest.json">manifest.json</a> includes strings that are displayed to the user, such as the extension's name and description. If you internationalize these strings and put the appropriate translations of them in messages.json, then the correct translation of the string will be displayed to the user, based on the current locale, like so.</p> + +<p>To internationalize strings, specify them like this:</p> + +<pre class="brush: json">"name": "__MSG_extensionName__", +"description": "__MSG_extensionDescription__",</pre> + +<p>Here, we are retrieving message strings dependant on the browser's locale, rather than just including static strings.</p> + +<p>To call a message string like this, you need to specify it like this:</p> + +<ol> + <li>Two underscores, followed by</li> + <li>The string "MSG", followed by</li> + <li>One underscore, followed by</li> + <li>The name of the message you want to call as defined in <code>messages.json</code>, followed by</li> + <li>Two underscores</li> +</ol> + +<pre><strong>__MSG_</strong> + <em>messageName</em> + <strong>__</strong></pre> + +<h3 id="Specifying_a_default_locale">Specifying a default locale</h3> + +<p>Another field you should specify in your manifest.json is <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/default_locale">default_locale</a>:</p> + +<pre class="brush: json">"default_locale": "en"</pre> + +<p>This specifies a default locale to use if the extension doesn't include a localized string for the browser's current locale. Any message strings that are not available in the browser locale are taken from the default locale instead. There are some more details to be aware of in terms of how the browser selects strings — see {{anch("Localized string selection")}}.</p> + +<h2 id="Locale-dependent_CSS">Locale-dependent CSS</h2> + +<p>Note that you can also retrieve localized strings from CSS files in the extension. For example, you might want to construct a locale-dependent CSS rule, like this:</p> + +<pre class="brush: css">header { + background-image: url(../images/__MSG_extensionName__/header.png); +}</pre> + +<p>This is useful, although you might be better off handling such a situation using {{anch("Predefined messages")}}.</p> + +<h2 id="Retrieving_message_strings_from_JavaScript">Retrieving message strings from JavaScript</h2> + +<p>So, you've got your message strings set up, and your manifest. Now you just need to start calling your message strings from JavaScript so your extension can talk the right language as much as possible. The actual <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n">i18n API</a> is pretty simple, containing just four main methods:</p> + +<ul> + <li>You'll probably use {{WebExtAPIRef("i18n.getMessage()")}} most often — this is the method you use to retrieve a specific language string, as mentioned above. We'll see specific usage examples of this below.</li> + <li>The {{WebExtAPIRef("i18n.getAcceptLanguages()")}} and {{WebExtAPIRef("i18n.getUILanguage()")}} methods could be used if you needed to customize the UI depending on the locale — perhaps you might want to show preferences specific to the users' preferred languages higher up in a prefs list, or display cultural information relevant only to a certain language, or format displayed dates appropriately according to the browser locale.</li> + <li>The {{WebExtAPIRef("i18n.detectLanguage()")}} method could be used to detect the language of user-submitted content, and format it appropriately.</li> +</ul> + +<p>In our <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> example, the<a href="https://github.com/mdn/webextensions-examples/blob/master/notify-link-clicks-i18n/background-script.js"> background script</a> contains the following lines:</p> + +<pre class="brush: js">var title = browser.i18n.getMessage("notificationTitle"); +var content = browser.i18n.getMessage("notificationContent", message.url);</pre> + +<p>The first one just retrieves the <code>notificationTitle message</code> field from the available <code>messages.json</code> file most appropriate for the browser's current locale. The second one is similar, but it is being passed a URL as a second parameter. What gives? This is how you specify the content to replace the <code>$URL$</code> placeholder we see in the <code>notificationContent message</code> field:</p> + +<pre class="brush: json">"notificationContent": { + "message": "You clicked $URL$.", + "description": "Tells the user which link they clicked.", + "placeholders": { + "url" : { + "content" : "$1", + "example" : "https://developer.mozilla.org" + } + } +} +</pre> + +<p>The <code>"placeholders"</code> member defines all the placeholders, and where they are retrieved from. The <code>"url"</code> placeholder specifies that its content is taken from $1, which is the first value given inside the second parameter of <code>getMessage()</code>. Since the placeholder is called <code>"url"</code>, we use <code>$URL$</code> to call it inside the actual message string (so for <code>"name"</code> you'd use <code>$NAME$</code>, etc.) If you have multiple placeholders, you can provide them inside an array that is given to {{WebExtAPIRef("i18n.getMessage()")}} as the second parameter — <code>[a, b, c]</code> will be available as <code>$1</code>, <code>$2</code>, and <code>$3</code>, and so on, inside <code>messages.json</code>.</p> + +<p>Let's run through an example: the original <code>notificationContent</code> message string in the <code>en/messages.json</code> file is</p> + +<pre>You clicked $URL$.</pre> + +<p>Let's say the link clicked on points to <code>https://developer.mozilla.org</code>. After the {{WebExtAPIRef("i18n.getMessage()")}} call, the contents of the second parameter are made available in messages.json as <code>$1</code>, which replaces the <code>$URL$</code> placeholder as defined in the <code>"url"</code> placeholder. So the final message string is</p> + +<pre>You clicked https://developer.mozilla.org.</pre> + +<h3 id="Direct_placeholder_usage">Direct placeholder usage</h3> + +<p>It is possible to insert your variables (<code>$1</code>, <code>$2</code>, <code>$3</code>, etc.) directly into the message strings, for example we could rewrite the above <code>"notificationContent"</code> member like this:</p> + +<pre class="brush: json">"notificationContent": { + "message": "You clicked $1.", + "description": "Tells the user which link they clicked." +}</pre> + +<p>This may seem quicker and less complex, but the other way (using <code>"placeholders"</code>) is seen as best practice. This is because having the placeholder name (e.g. <code>"url"</code>) and example helps you to remember what the placeholder is for — a week after you write your code, you'll probably forget what <code>$1</code>–<code>$8</code> refer to, but you'll be more likely to know what your placeholder names refer to.</p> + +<h3 id="Hardcoded_substitution">Hardcoded substitution</h3> + +<p>It is also possible to include hardcoded strings in placeholders, so that the same value is used every time, instead of getting the value from a variable in your code. For example:</p> + +<pre class="brush: json">"mdn_banner": { + "message": "For more information on web technologies, go to $MDN$.", + "description": "Tell the user about MDN", + "placeholders": { + "mdn": { + "content": "https://developer.mozilla.org/" + } + } +}</pre> + +<p>In this case we are just hardcoding the placeholder content, rather than getting it from a variable value like <code>$1</code>. This can sometimes be useful when your message file is very complex, and you want to split up different values to make the strings more readable in the file, plus then these values could be accessed programmatically.</p> + +<p>In addition, you can use such substitutions to specify parts of the string that you don't want to be translated, such as person or business names.</p> + +<h2 id="Localized_string_selection">Localized string selection</h2> + +<p>Locales can be specified using only a language code, like <code>fr</code> or <code>en</code>, or they may be further qualified with a region code, like <code>en_US</code> or <code>en_GB</code>, which describes a regional variant of the same basic language. When you ask the i18n system for a string, it will select a string using the following algorithm:</p> + +<ol> + <li>if there is a <code>messages.json</code> file for the exact current locale, and it contains the string, return it.</li> + <li>Otherwise, if the current locale is qualified with a region (e.g. <code>en_US</code>) and there is a <code>messages.json</code> file for the regionless version of that locale (e.g. <code>en</code>), and that file contains the string, return it.</li> + <li>Otherwise, if there is a <code>messages.json</code> file for the <code>default_locale</code> defined in the <code>manifest.json</code>, and it contains the string, return it.</li> + <li>Otherwise return an empty string.</li> +</ol> + +<p>Take the following example:</p> + +<ul class="directory-tree"> + <li>extension-root-directory/ + <ul> + <li>_locales + <ul> + <li>en_GB + <ul> + <li>messages.json + <ul> + <li><code>{ "colorLocalised": { "message": "colour", "description": "Color." }, ... }</code></li> + </ul> + </li> + </ul> + en + + <ul> + <li>messages.json + <ul> + <li><code>{ "colorLocalised": { "message": "color", "description": "Color." }, ... }</code></li> + </ul> + </li> + </ul> + </li> + <li>fr + <ul> + <li>messages.json + <ul> + <li><code>{ "colorLocalised": { "message": "<span lang="fr">couleur</span>", "description": "Color." }, ...}</code></li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> +</ul> + +<p>Suppose the <code>default_locale</code> is set to <code>fr</code>, and the browser's current locale is <code>en_GB</code>:</p> + +<ul> + <li>If the extension calls <code>getMessage("colorLocalised")</code>, it will return "colour".</li> + <li>If "colorLocalised" were not present in <code>en_GB</code>, then <code>getMessage("colorLocalised")</code>, would return "color", not "couleur".</li> +</ul> + +<h2 id="Predefined_messages">Predefined messages</h2> + +<p>The i18n module provides us with some predefined messages, which we can call in the same way as we saw earlier in {{anch("Calling message strings from manifests and extension CSS")}}. For example:</p> + +<pre>__MSG_extensionName__</pre> + +<p>Predefined messages use exactly the same syntax, except with <code>@@</code> before the message name, for example</p> + +<pre>__MSG_@@ui_locale__</pre> + +<p>The following table shows the different available predefined messages:</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Message name</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>@@extension_id</code></td> + <td> + <p>The extension's internally-generated UUID. You might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.</p> + + <p>You can't use this message in a manifest file.</p> + + <p>Also note that this ID is <em>not</em> the add-on ID returned by {{WebExtAPIRef("runtime.id")}}, and that can be set using the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a> key in manifest.json. It's the generated UUID that appears in the add-on's URL. This means that you can't use this value as the <code>extensionId</code> parameter to {{WebExtAPIRef("runtime.sendMessage()")}}, and can't use it to check against the <code>id</code> property of a {{WebExtAPIRef("runtime.MessageSender")}} object.</p> + </td> + </tr> + <tr> + <td><code>@@ui_locale</code></td> + <td>The current locale; you might use this string to construct locale-specific URLs.</td> + </tr> + <tr> + <td><code>@@bidi_dir</code></td> + <td>The text direction for the current locale, either "ltr" for left-to-right languages such as English or "rtl" for right-to-left languages such as Arabic.</td> + </tr> + <tr> + <td><code>@@bidi_reversed_dir</code></td> + <td>If the <code>@@bidi_dir</code> is "ltr", then this is "rtl"; otherwise, it's "ltr".</td> + </tr> + <tr> + <td><code>@@bidi_start_edge</code></td> + <td>If the <code>@@bidi_dir</code> is "ltr", then this is "left"; otherwise, it's "right".</td> + </tr> + <tr> + <td><code>@@bidi_end_edge</code></td> + <td>If the <code>@@bidi_dir</code> is "ltr", then this is "right"; otherwise, it's "left".</td> + </tr> + </tbody> +</table> + +<p>Going back to our earlier example, it would make more sense to write it like this:</p> + +<pre class="brush: css">header { + background-image: url(../images/__MSG_@@ui_locale__/header.png); +}</pre> + +<p>Now we can just store our local specific images in directories that match the different locales we are supporting — en, de, etc. — which makes a lot more sense.</p> + +<p>Let's look at an example of using <code>@@bidi_*</code> messages in a CSS file:</p> + +<pre class="brush: css">body { + direction: __MSG_@@bidi_dir__; +} + +div#header { + margin-bottom: 1.05em; + overflow: hidden; + padding-bottom: 1.5em; + padding-__MSG_@@bidi_start_edge__: 0; + padding-__MSG_@@bidi_end_edge__: 1.5em; + position: relative; +}</pre> + +<p>For left-to-right languages such as English, the CSS declarations involving the predefined messages above would translate to the following final code lines:</p> + +<pre class="brush: css">direction: ltr; +padding-left: 0; +padding-right: 1.5em; +</pre> + +<p>For a right-to-left language like Arabic, you'd get:</p> + +<pre class="brush: css">direction: rtl; +padding-right: 0; +padding-left: 1.5em;</pre> + +<h2 id="Testing_out_your_extension">Testing out your extension</h2> + +<p>Starting in Firefox 45, you can install extensions temporarily from disk — see <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Packaging_and_installation#Loading_from_disk">Loading from disk</a>. Do this, and then try testing out our <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> extension. Go to one of your favourite websites and click a link to see if a notification appears reporting the URL of the clicked link.</p> + +<p>Next, change Firefox's locale to one supported in the extension that you want to test.</p> + +<ol> + <li>Open "about:config" in Firefox, and search for the <code>general.useragent.locale</code> preference.</li> + <li>Double click on the preference (or press Return/Enter) to select it, enter the language code for the locale you want to test, then click "OK" (or press Return/Enter). For example in our example extension, "en" (English), "de" (German), "nl" (Dutch), and "ja" (Japanese) are supported.</li> + <li>Search for <code>intl.locale.matchOS</code> and double click the preference so that it is set to <code>false</code>.</li> + <li>Restart your browser to complete the change.</li> +</ol> + +<div class="note"> +<p><strong>Note</strong>: This works to change the browser's locale, even if you haven't got the <a href="https://addons.mozilla.org/en-US/firefox/language-tools/">language pack</a> installed for that language. You'll just get the browser UI in your default language if this is the case.</p> +</div> + +<ol> +</ol> + +<p>Load the extension temporarily from disk again, then test your new locale:</p> + +<ul> + <li>Visit "about:addons" again — you should now see the extension listed, with its icon, plus name and description in the chosen language.</li> + <li>Test your extension again. In our example, you'd go to another website and click a link, to see if the notification now appears in the chosen language.</li> +</ul> + +<p>{{EmbedYouTube("R7--fp5pPGg")}}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/author/index.html b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/author/index.html new file mode 100644 index 0000000000..a99d8438e8 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/author/index.html @@ -0,0 +1,44 @@ +--- +title: 作者 +slug: Mozilla/Add-ons/WebExtensions/manifest.json/author +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/author +--- +<div> +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">型別</th> + <td><code>String</code></td> + </tr> + <tr> + <th scope="row">強制</th> + <td>No</td> + </tr> + <tr> + <th scope="row">範例</th> + <td> + <pre class="brush: json no-line-numbers language-json"> +<code class="language-json"><span class="key token">"author":</span> <span class="string token">"cool puppy"</span></code></pre> + </td> + </tr> + </tbody> +</table> + +<p>套件作者,用來顯示在瀏覽器的用戶介面中。如果有提供 <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/developer">developer</a> 鍵而且裡面包含 "name" 屬性,那會覆蓋author鍵。不能指定多個作者。</p> + +<p>這是一個<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Internationalization#Internationalizing_manifest.json">可侷限的屬性</a>。</p> +</div> + +<p> </p> + +<h2 id="範例">範例</h2> + +<pre class="brush: json no-line-numbers language-json"><code class="language-json"><span class="key token">"author":</span> <span class="string token">"cool puppy"</span></code></pre> + +<h2 id="瀏覽器兼容">瀏覽器兼容</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.manifest.author")}}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/background/index.html b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/background/index.html new file mode 100644 index 0000000000..d02b6eb600 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/background/index.html @@ -0,0 +1,93 @@ +--- +title: background +slug: Mozilla/Add-ons/WebExtensions/manifest.json/background +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/background +--- +<div> +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">型別</th> + <td><code>Object</code></td> + </tr> + <tr> + <th scope="row">強制</th> + <td>No</td> + </tr> + <tr> + <th scope="row">範例</th> + <td> + <pre class="brush: json no-line-numbers language-json"> +<code class="language-json"><span class="key token">"background":</span> <span class="punctuation token">{</span> + <span class="key token">"scripts":</span> <span class="punctuation token">[</span><span class="string token">"background.js"</span><span class="punctuation token">]</span> +<span class="punctuation token">}</span></code></pre> + </td> + </tr> + </tbody> +</table> + +<p>用 <code>background</code> 鍵來引入一個或多個後端腳本,還有一個選擇性的套件後端頁面。</p> + +<p>後端腳本是用來放置一些需要維護長期狀態或是進行長期操作的程式碼,它麼的生命週期跟任何網頁或瀏覽器視窗是獨立的。</p> + +<p>後端腳本會在套件一被讀取就被讀入,一直到套件被禁用或移除才會卸載。只要你有請求對應的<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">權限</a>你可以在這個腳本裡使用任何擴充套件 APIs。</p> + +<p>更多細節,查看<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_pages">套件解析</a>的"後端頁面"章節。</p> + +<p><code>background</code> 鍵是一個物件,可能包含下列二屬性其中之一,兩者都是選擇性的:</p> + +<table class="standard-table"> + <tbody> + <tr> + <td><code>"scripts"</code></td> + <td> + <p>一個字串組成的陣列,每個都是 JavaScript 原始碼的路徑。路徑是 manifest.json 檔案自身的相對路徑。這些是會被套件讀取的後端腳本。</p> + + <p>腳本共用全局 <code>window</code>。</p> + + <p>腳本根據陣列裡的順序讀入。</p> + + <p><strong>註:Firefox 版本50以前有一個錯誤</strong> 當 Firefox 除錯器開啓時,腳本並不總是按照陣列裡的順序讀入。要解決這個錯誤,你可以用 <code>"page"</code> 屬性並且在頁面中透過 <code><script></code> 標籤讀入後端腳本。這個錯誤在 Firefox 50 被修正,從那開始腳本總是會依照陣列中的順序讀入。</p> + + <div class="note"> + <p><strong>註:</strong> 如果你想要用<code><script>標籤</code>從遠端取得一個腳本(例如 <code><script src = "https://code.jquery.com/jquery-1.7.1.min.js"></code>),你必須要修改套件 manifest.json 中的 <code>content_security_policy</code> 鍵。</p> + </div> + </td> + </tr> + <tr> + <td><code>"page"</code></td> + <td> + <p>如果你指定 <code>"scripts"</code>,那麼爲了讓你的腳本執行一個空白頁面會被建立。</p> + + <p>如果頁面中需要某些內容,你可以用 <code>"page"</code> 選項定義自己的頁面。</p> + + <p>如果你用了這個屬性,你就不能透過 <code>"scripts"</code> 來指定後端腳本。但是你可以像一般的網頁一樣在頁面中引入你自己的腳本。</p> + </td> + </tr> + </tbody> +</table> + +<h2 id="範例">範例</h2> + +<pre class="brush: json no-line-numbers language-json"><code class="language-json"> <span class="key token">"background":</span> <span class="punctuation token">{</span> + <span class="key token">"scripts":</span> <span class="punctuation token">[</span><span class="string token">"jquery.js"</span><span class="punctuation token">,</span> <span class="string token">"my-background.js"</span><span class="punctuation token">]</span> + <span class="punctuation token">}</span></code></pre> + +<p>讀取兩個後端腳本。</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"background":</span> <span class="punctuation token">{</span> + <span class="key token">"page":</span> <span class="string token">"my-background.html"</span> + <span class="punctuation token">}</span></code></pre> + +<p>讀取一個自訂的後端頁面。</p> + +<h2 id="瀏覽器兼容">瀏覽器兼容</h2> +</div> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.manifest.background", 10)}}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html new file mode 100644 index 0000000000..7a96adfecc --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html @@ -0,0 +1,88 @@ +--- +title: applications +slug: Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings +--- +<div> +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">型別</th> + <td><code>Object</code></td> + </tr> + <tr> + <th scope="row">強制</th> + <td>通常是不強制(請看<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID#When_do_you_need_an_add-on_ID">你什麼時候會需要 Add-on ID?</a>)。在 Firefox 48(桌面)前以及Android版Firefox 是強制的。</td> + </tr> + <tr> + <th scope="row">範例</th> + <td> + <pre class="brush: json no-line-numbers language-json"> +<code class="language-json"><span class="key token">"applications":</span> <span class="punctuation token">{</span> + <span class="key token">"gecko":</span> <span class="punctuation token">{</span> + <span class="key token">"id":</span> <span class="string token">"addon@example.com"</span><span class="punctuation token">,</span> + <span class="key token">"strict_min_version":</span> <span class="string token">"42.0"</span> + <span class="punctuation token">}</span> +<span class="punctuation token">}</span></code></pre> + </td> + </tr> + </tbody> +</table> + +<h2 id="敘述">敘述</h2> + +<p><code>applications</code> 鍵包含了詳細描述特定應用的鍵。</p> + +<p>目前這只包含了一個鍵,<code>gecko</code>,它包含4個string參數:</p> + +<ul> + <li><code>id</code> 是套件ID。Firefox 48 以後爲選擇性,48前爲強制。需要什麼來指定 add-on ID 請查看<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID">套件與 Add-on ID</a>。</li> + <li><code>strict_min_version</code>:支持的最舊Gecko版本。在這個欄位版本號包含 "*" 是不合法的。預設是 "42a1"。</li> + <li><code>strict_max_version</code>: 支持的最新Gecko版本。如果套件安裝的 Firefox 版本超過這個版本號則套件會被禁用或不被允許安裝。預設爲 "*",表示禁用最新支持版本檢查。</li> + <li><code>update_url</code> 是<a href="https://developer.mozilla.org/en-US/Add-ons/Updates">套件更新 manifest</a>。備:連結必須以 "https" 開頭。這個鍵用來自己管理套件更新(不透過套件管理器)。</li> +</ul> + +<p>查看<a href="https://addons.mozilla.org/en-US/firefox/pages/appversions/">可用Gecko版本</a>。</p> + +<h3 class="highlight-spanned" id="套件ID格式"><span class="highlight-span">套件ID格式</span></h3> + +<p>套件ID格式必須是下列其中一種:</p> + +<ul> + <li><a href="https://en.wikipedia.org/wiki/Universally_unique_identifier" title="Generating_GUIDs">GUID</a></li> + <li>寫得像信箱地址的字串:<code class="plain">extensionname@example.org</code></li> +</ul> + +<p>後者比較容易產生與操作。小心,在這裡使用真實信箱地址可能會引來垃圾信件。</p> + +<p>例如:</p> + +<pre class="brush:json;auto-links:false no-line-numbers language-json"><code class="language-json"><span class="key token">"id":</span> <span class="string token">"extensionname@example.org"</span><span class="punctuation token">,</span> + +<span class="key token">"id":</span> <span class="string token">"{daf44bf7-a45e-4450-979c-91cf07434c3d}"</span></code></pre> + +<p> </p> + +<h2 id="範例">範例</h2> + +<p>包含所有可用鍵的範例。註:大多數套件會忽略 <code>strict_max_version</code> 和 <code>update_url</code>。</p> + +<pre class="brush: json no-line-numbers language-json"><code class="language-json"><span class="key token">"applications":</span> <span class="punctuation token">{</span> + <span class="key token">"gecko":</span> <span class="punctuation token">{</span> + <span class="key token">"id":</span> <span class="string token">"addon@example.com"</span><span class="punctuation token">,</span> + <span class="key token">"strict_min_version":</span> <span class="string token">"42.0"</span><span class="punctuation token">,</span> + <span class="key token">"strict_max_version":</span> <span class="string token">"50.*"</span><span class="punctuation token">,</span> + <span class="key token">"update_url":</span> <span class="string token">"https://example.com/updates.json"</span> + <span class="punctuation token">}</span> +<span class="punctuation token">}</span></code></pre> + +<h2 id="瀏覽器兼容">瀏覽器兼容</h2> +</div> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.manifest.browser_specific_settings")}}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/homepage_url/index.html b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/homepage_url/index.html new file mode 100644 index 0000000000..4a9b065496 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/homepage_url/index.html @@ -0,0 +1,46 @@ +--- +title: homepage_url +slug: Mozilla/Add-ons/WebExtensions/manifest.json/homepage_url +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/homepage_url +--- +<div> +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">型別</th> + <td><code>String</code></td> + </tr> + <tr> + <th scope="row">強制</th> + <td>No</td> + </tr> + <tr> + <th scope="row">範例</th> + <td> + <pre class="brush: json no-line-numbers language-json"> +<code class="language-json"><span class="key token">"homepage_url":</span> <span class="string token">"https://example.org/my-addon"</span></code></pre> + </td> + </tr> + </tbody> +</table> + +<p>套件首頁的URL。</p> + +<p>如果有 <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/developer">developer</a> 鍵且它包含 "url" 屬性,這會覆蓋 homepage_url 鍵。</p> + +<p>這是一個<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Internationalization#Internationalizing_manifest.json">可侷限的屬性</a>。</p> + +<h2 id="範例">範例</h2> + +<pre class="brush: json no-line-numbers language-json"><code class="language-json"><span class="key token">"homepage_url":</span> <span class="string token">"https://github.com/mdn/webextensions-examples/tree/master/beastify"</span></code></pre> + +<h2 id="瀏覽器兼容性">瀏覽器兼容性</h2> +</div> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.manifest.homepage_url")}}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/index.html b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/index.html new file mode 100644 index 0000000000..23eda6a41c --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/index.html @@ -0,0 +1,113 @@ +--- +title: manifest.json +slug: Mozilla/Add-ons/WebExtensions/manifest.json +tags: + - Add-ons + - Extensions + - NeedsTranslation + - TopicStub + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json +--- +<div>{{AddonSidebar}}</div> + +<p>manifest.json 是所有採用 WebExtension API 的擴充功能中、唯一一個必須包含的檔案。</p> + +<p>你可透過 manifest.json 為擴充功能指定名稱(name)、版本(version)這類的基本元資料(metadata),也可指定擴充功能的一些相關功能,例如像是背景腳本(background scripts)、內容腳本(content scripts)、瀏覽器動作(browser actions)等等。</p> + +<p>這是個採用 <a href="/en-US/docs/Glossary/JSON">JSON</a> 格式的檔案,但有個例外:它可接受含有 "<code>//</code>" 這種格式的註解文字。</p> + +<p>manifest.json 可採用的鍵值如下所列:</p> + +<div class="twocolumns">{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}</div> + +<div class="twocolumns"> </div> + +<p><code>"manifest_version"</code>、<code>"version"</code> 和 <code>"name"</code> 是一定要設定的鍵值。另外,如果有設定 "_locales" directory ,就一定要設定 <code>"default_locale"</code> ,否則就是這兩個鍵值都不做設定。 Google Chrome, 並不支援 <code>"applications"</code> ,但針對 Firefox 48 之前及 Android 的版本,則必須設置這個鍵值。</p> + +<p>你可透過擴充功能中的 JavaScript,藉由 {{WebExtAPIRef("runtime.getManifest()")}} 這個函式來存取擴充功能裡的 manifest :</p> + +<pre class="brush: js">browser.runtime.getManifest().version;</pre> + +<h2 id="範例">範例</h2> + +<p>以下程式碼顯示的是一般 manifest 鍵值的基本語法。請注意,這個範例並不是讓你用來直接複製貼上的,你必須根據所開發的擴充功能,填入相應的鍵值、關於擴充功能的完整範例,請參見 <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Examples">擴充功能範例</a>。</p> + +<pre class="brush: json">{ + "applications": { + "gecko": { + "id": "addon@example.com", + "strict_min_version": "42.0" + } + }, + + "background": { + "scripts": ["jquery.js", "my-background.js"], + "page": "my-background.html" + }, + + "browser_action": { + "default_icon": { + "19": "button/geo-19.png", + "38": "button/geo-38.png" + }, + "default_title": "Whereami?", + "default_popup": "popup/geo.html" + }, + + "commands": { + "toggle-feature": { + "suggested_key": { + "default": "Ctrl+Shift+Y", + "linux": "Ctrl+Shift+U" + }, + "description": "Send a 'toggle-feature' event" + } + }, + + "content_security_policy": "script-src 'self' https://example.com; object-src 'self'", + + "content_scripts": [ + { + "exclude_matches": ["*://developer.mozilla.org/*"], + "matches": ["*://*.mozilla.org/*"], + "js": ["borderify.js"] + } + ], + + "default_locale": "en", + + "description": "...", + + "icons": { + "48": "icon.png", + "96": "icon@2x.png" + }, + + "manifest_version": 2, + + "name": "...", + + "page_action": { + "default_icon": { + "19": "button/geo-19.png", + "38": "button/geo-38.png" + }, + "default_title": "Whereami?", + "default_popup": "popup/geo.html" + }, + + "permissions": ["webNavigation"], + + "version": "0.1", + + "web_accessible_resources": ["images/my-image.png"] +}</pre> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p>若想對所有的 manifest 鍵值及其子健有個完整的概念,可參見 <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json">完整 manifest.json 瀏覽器相容表</a>。</p> + +<div class="hidden">此頁面的相容表是根據結構化資料所生成的。如果你想對該資料做出貢獻,可直接 check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 並以 pull request 的方式回饋給我們。</div> + +<p>{{Compat("webextensions.manifest")}}</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/options_ui/index.html b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/options_ui/index.html new file mode 100644 index 0000000000..7a376817f1 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/manifest.json/options_ui/index.html @@ -0,0 +1,110 @@ +--- +title: options_ui +slug: Mozilla/Add-ons/WebExtensions/manifest.json/options_ui +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/options_ui +--- +<div> +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">型別</th> + <td><code>Object</code></td> + </tr> + <tr> + <th scope="row">強制</th> + <td>No</td> + </tr> + <tr> + <th scope="row">範例</th> + <td> + <pre class="brush: json no-line-numbers language-json"> +<code class="language-json"><span class="key token">"options_ui":</span> <span class="punctuation token">{</span> + <span class="key token">"page":</span> <span class="string token">"options/options.html"</span> +<span class="punctuation token">}</span></code></pre> + </td> + </tr> + </tbody> +</table> + +<p>用 <code>options_ui</code> 鍵來定義套件的<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Options_pages">選項頁面</a>。</p> + +<p>選項頁面包含了套件的設定。用戶可以從套件管理員進入這個畫面,而你可以用{{WebExtAPIRef("runtime.openOptionsPage()")}}打開它。</p> + +<p>指定 <code>options_ui</code> 爲一個與套件打包在一起的HTML檔案路徑。就像一般的網頁一樣,HTML檔案可包含CSS與JavaScript檔案。跟普通頁面不同的是,它可以使用所有被<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">授權</a>的<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API">套件APIs</a>。 不過,它執行的作用域不同於你的後端腳本。</p> + +<p>如果你想在<strong>選項頁面</strong>與<strong>後端腳本</strong>的JavaScript裡<strong>共用</strong>資料或函數,你可以透過用{{WebExtAPIRef("extension.getBackgroundPage()")}}與後端腳本的 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window">Window</a> 關聯、用{{WebExtAPIRef("extension.getViews()")}}與任何套件內腳本的{{domxref("Window")}}關聯來實現。你也可以透過 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/sendMessage">runtime.sendMessage()</a></code>、 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage">runtime.onMessage</a></code>,跟(或)<code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/connect">runtime.connect()</a></code>在選項頁面與後端的頁面的JavaScript之間溝通。<br> + 後者(或是<code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code>)也可以用來在<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Background_scripts">後端腳本</a>與<strong><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts">內容腳本</a></strong>之間共用選項。</p> + +<p>一般要儲存選項頁面的選項變動時,你要可能會用 <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage">storage API</a>、<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync">storage.sync</a>(如果你想要在所有用戶登入的瀏覽器實例之間同步設定的話),或者透過 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local">storage.local</a> (如果設定是針對目前身份或機器)。而如果你希望你的<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Background_scripts">後端腳本</a>(或<a href="https://developer.mozilla.org/en-US/docs/">內容腳本</a>)監聽該變化,你可以加上 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/onChanged">storage.onChanged</a> 監聽器。</p> + +<h2 id="語法">語法</h2> + +<p><code>options_ui</code> 鍵是一個包含了下列內容的物件:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col">Name</th> + <th scope="col">Type</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td><code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles">browser_style</a></code></td> + <td><code>Boolean</code></td> + <td> + <p>可選,預設爲 <code>true</code>。</p> + + <p>用這個來替你的頁面引入一個樣式表,使你的頁面與瀏覽器UI以及其他用 <code>browser_style</code> 的套件看起來一致。雖然它預設是<code>true</code>還是建議你加入這個屬性。</p> + + <p>在 Firefox 裡,樣式表可以在 chrome://browser/content/extension.css 或 chrome://browser/content/extension-mac.css(OS X)查看。設定尺寸的時候注意到這個樣式表目前會做這個設定<code>box-sizing: border-box</code> (查看 <a href="https://developer.mozilla.org/docs/Web/CSS/box-sizing">box-sizing</a>)。</p> + + <p><a class="external external-icon" href="https://firefoxux.github.io/StyleGuide/#/controls">Firefox風格指南</a>寫到一些你可以應用到彈出視窗裡面的元素上來變成特定樣式的class。</p> + </td> + </tr> + <tr> + <td><code>open_in_tab</code></td> + <td><code>Boolean</code></td> + <td> + <p>可選,預設爲 <code>false</code>。</p> + + <p>如果設爲 <code>true</code>,選項頁面會在普通的瀏覽器頁籤開啓而不是整合在瀏覽器的套件管理員裡。</p> + </td> + </tr> + <tr> + <td><code>page</code></td> + <td><code>String</code></td> + <td> + <p>強制。</p> + + <p>包含選項頁面細項的HTML檔案路徑。</p> + + <p>這個路徑是 manifest.json 的相對路徑。</p> + </td> + </tr> + </tbody> +</table> + +<h2 id="範例">範例</h2> + +<pre class="brush: json no-line-numbers language-json"><code class="language-json"> <span class="key token">"options_ui":</span> <span class="punctuation token">{</span> + <span class="key token">"page":</span> <span class="string token">"options/options.html"</span> + <span class="punctuation token">}</span></code></pre> + +<h2 id="瀏覽器兼容性">瀏覽器兼容性</h2> +</div> + + + +<p>{{Compat("webextensions.manifest.options_ui")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles">Browser styles</a></li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/user_interface/browser_action/index.html b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/browser_action/index.html new file mode 100644 index 0000000000..afdf61f340 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/browser_action/index.html @@ -0,0 +1,50 @@ +--- +title: 工具列按鈕 +slug: Mozilla/Add-ons/WebExtensions/user_interface/Browser_action +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Browser_action +--- +<div>{{AddonSidebar}}</div> + +<p>根據<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction">工具列按鈕</a>,這個用戶介面是一個加到瀏覽器工具列的按鈕。用戶透過點擊按鈕來與你的套件互動。<br> + <img alt="" src="https://mdn.mozillademos.org/files/15751/browser-action.png" style="display: block; height: 182px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<p>工具列按鈕與網址列按鈕非常相似。關於差別以及何時該使用的指引,詳閱<a href="/en-US/Add-ons/WebExtensions/user_interface/Page_actions#Page_actions_and_browser_actions">工具列按鈕。</a></p> + +<h2 id="詳細指定工具列按鈕">詳細指定工具列按鈕</h2> + +<p>透過在 manifest.json 中使用 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> 鍵來定義工具列按鈕的屬性:</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"browser_action":</span> <span class="punctuation token">{</span> + <span class="key token">"default_icon":</span> <span class="punctuation token">{</span> + <span class="key token">"19":</span> <span class="string token">"button/geo-19.png"</span><span class="punctuation token">,</span> + <span class="key token">"38":</span> <span class="string token">"button/geo-38.png"</span> + <span class="punctuation token">}</span><span class="punctuation token">,</span> + <span class="key token">"default_title":</span> <span class="string token">"我在哪?"</span> +<span class="punctuation token">}</span></code></pre> + +<p>唯一一個強制的鍵只有 <code>default_icon</code>。</p> + +<p>指定工具列按鈕的方式有兩種: 有<a href="/en-US/Add-ons/WebExtensions/Popups">彈出視窗</a>跟沒有<a href="/en-US/Add-ons/WebExtensions/Popups">彈出視窗</a>。如果你不指定彈出視窗,當用戶點擊按鈕事件會被傳送到套件,而套件透過 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/BrowserAction/onClicked" title="Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup."><code>browserAction.onClicked</code></a> 監聽:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js">browser<span class="punctuation token">.</span>browserAction<span class="punctuation token">.</span>onClicked<span class="punctuation token">.</span><span class="function token">addListener</span><span class="punctuation token">(</span>handleClick<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> + +<p>如果你指定彈出視窗,點擊事件不會被傳送,取而代之當用戶點擊按鈕時彈出視窗會被展開。用戶可以跟彈出視窗互動且當用戶點擊了彈出視窗外側它會自動關閉。更多建立與管理彈出視窗的細節請查看<a href="/en-US/Add-ons/WebExtensions/Popups">彈出視窗</a>文章。</p> + +<p>註: 你的套件只能有一個工具列按鈕。</p> + +<p>你可以透過 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction">browserAction</a></code> API 程式化地更改任何工具列按鈕的屬性。</p> + +<h2 id="圖示">圖示</h2> + +<p>更多關於建立工具列按鈕使用的圖示,請查看文件<a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">光子設計系統</a>裡的<a href="https://design.firefox.com/photon/visuals/iconography.html">圖示學</a>。</p> + +<h2 id="範例">範例</h2> + +<p>GitHub上的<a href="https://github.com/mdn/webextensions-examples">擴充套件範例</a>程式庫包含兩個建立工具列按鈕的範例:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/blob/master/bookmark-it/">bookmark-it</a> 使用不含彈出視窗的工具列按鈕。</li> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/beastify">beastify</a> 使用包含彈出視窗的工具列按鈕。</li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/user_interface/context_menu_items/index.html b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/context_menu_items/index.html new file mode 100644 index 0000000000..949ec58b74 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/context_menu_items/index.html @@ -0,0 +1,54 @@ +--- +title: 快捷選單項 +slug: Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>這個用戶介面添加一個或多個項目到瀏覽器的快捷選單。這是用戶在網頁上點擊右鍵時出現的選單。頁籤也可以透過 <a href="/en-US/Add-ons/WebExtensions/API/menus">browser.menus API</a> 使用快捷選單。</p> + +<p><img alt="Example of content menu items added by a WebExtension, from the context-menu-demo example" src="https://mdn.mozillademos.org/files/15756/context_menu_example.png" style="display: block; height: 382px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<p>你可以用這個介面來顯示一些跟特定瀏覽器或網頁內容相關的功能。舉例來說,當用戶在圖片上按右鍵時提供圖片編輯器的功能或者在反白內容上按右鍵時提供儲存頁面內容的功能。你可以對選單添加普通的選單項目、核取方塊、單選按鈕組以及分隔線。選單項目透過{{WebExtAPIRef("contextMenus.create")}}添加後透過它會顯示在所有瀏覽器頁籤,但是你可以透過{{WebExtAPIRef("contextMenus.remove")}}來移除它。</p> + +<h2 id="指定快捷選單項目">指定快捷選單項目</h2> + +<p>透過{{WebExtAPIRef("contextMenus")}} API可以程式化地管理快捷選單項目。然而,你必須請求 <code>contextMenus</code> 的權限才能使用這些API的好處。</p> + +<pre class="brush: json">"permissions": ["contextMenus"]</pre> + +<p>現在你可以在你套件的後端腳本處添加(修改/刪除)選單項目。建立一個選單項目你要指定 id,標題以及它應該隸屬於哪個選單:</p> + +<pre class="brush: js">browser.contextMenus.create({ + id: "log-selection", + title: browser.i18n.getMessage("contextMenuItemSelectionLogger"), + contexts: ["selection"] +}, onCreated);</pre> + +<p>接著你的套件會監聽選單項目的點擊。送出有關項目點擊、點擊環境以及發生點擊頁籤的資訊可以用來使用恰當的套件功能。</p> + +<pre class="brush: js">browser.contextMenus.onClicked.addListener(function(info, tab) { + switch (info.menuItemId) { + case "log-selection": + console.log(info.selectionText); + break; + ... + } +})</pre> + +<h2 id="圖示">圖示</h2> + +<p>更多關於建立快捷選單圖示的細節請查看文件<a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">光子設計系統</a>的<a href="https://design.firefox.com/photon/visuals/iconography.html">圖示學</a>。</p> + +<h2 id="範例">範例</h2> + +<p>GitHub上的<a class="external external-icon" href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> 程式庫包含了兩個建立快捷選單的範例:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/menu-demo">menu-demo</a> 替瀏覽器的快捷選單添加幾個項目。</li> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/context-menu-copy-link-with-types">context-menu-copy-link-with-types</a> 替連結添加一個快捷選單項,以純文字或rich HTML的形式複製連結的UR。</li> +</ul> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/user_interface/devtools_panels/index.html b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/devtools_panels/index.html new file mode 100644 index 0000000000..fddea1b0e0 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/devtools_panels/index.html @@ -0,0 +1,66 @@ +--- +title: 開發工具面板 +slug: Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels +tags: + - 初學者 + - 擴充套件 + - 教學 + - 用戶介面 +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels +--- +<div>{{AddonSidebar}}</div> + +<div class="note"> +<p>Firefox 54 以後可以使用這個功能。</p> +</div> + +<p>當套件提供開發者使用的工具時,可以以一個瀏覽器開發工具的新面板的形式在開發者工具裡添加一個UI。</p> + +<p><img alt='Simple example showing the addition of "My panel" to the Developer Tools tabs.' src="https://mdn.mozillademos.org/files/15746/developer_panel_tab.png" style="display: block; height: 112px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<h2 id="指定開發工具面板">指定開發工具面板</h2> + +<p>開發工具面板可以透過 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.panels">devtools.panels</a></code> API 添加,因此這必須在特別的開發工具頁面執行。</p> + +<p>透過在套件的 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> 添加 <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/devtools_page">devtools_page</a></code> 鍵並提供HTML檔案來添加開發工具頁面:</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"devtools_page":</span> <span class="string token">"devtools-page.html"</span></code></pre> + +<p>在開發工具頁面,呼叫腳本會添加開發工具面板:</p> + +<pre class="brush: html"><body> + <script src="devtools.js"></script> +</body></pre> + +<p>在腳本裡,藉由指定面板標題、圖示、HTML檔案來建立開發工具:</p> + +<pre class="brush: js">function handleShown() { + console.log("panel is being shown"); +} + +function handleHidden() { + console.log("panel is being hidden"); +} + +browser.devtools.panels.create( + "My Panel", // title + "icons/star.png", // icon + "devtools/panel/panel.html" // content +).then((newPanel) => { + newPanel.onShown.addListener(handleShown); + newPanel.onHidden.addListener(handleHidden); +});</pre> + +<p>套件現在可以在檢測器視窗透過 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.inspectedWindow/eval"><code>devtools</code>.inspectedWindow.eval()</a></code> 或透過後端腳本傳送訊息來插入內容腳本兩種方式執行。你可以在<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools">擴充開發者工具</a>找到更多相關訊息。</p> + +<h2 id="開發面板設計">開發面板設計</h2> + +<p>更多關於如何設計符合 Firefox 風格的開發者面板,請查看文件<a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">光子設計系統</a>。</p> + +<h2 id="圖示">圖示</h2> + +<p>更多關於建立開發者工具面板圖示的細節,請查看文件<a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">光子設計系統</a>的<a href="https://design.firefox.com/photon/visuals/iconography.html">圖示學</a>。</p> + +<h2 id="範例">範例</h2> + +<p>GitHub上的 <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> 程式庫包含了建立開發工具面板的 <a href="https://github.com/mdn/webextensions-examples/blob/master/devtools-panels/">devtools-panels</a> 範例。</p> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/user_interface/index.html b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/index.html new file mode 100644 index 0000000000..5c8e40bcdd --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/index.html @@ -0,0 +1,94 @@ +--- +title: 用戶介面 +slug: Mozilla/Add-ons/WebExtensions/user_interface +tags: + - 擴充套件 + - 用戶介面 +translation_of: Mozilla/Add-ons/WebExtensions/user_interface +--- +<div>{{AddonSidebar}}</div> + +<p>套件APIs 提供了幾種介面來完成對用戶的功能。下方是那些介面的概述,每種用戶介面都有更詳細的資訊可以查閱。</p> + +<div class="note"> +<p>爲了使用這些UI元件在套件裡提供優秀的用戶體驗,建議閱讀<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/User_experience_best_practices">用戶體驗最佳實踐</a>文章。</p> +</div> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col"> + <p>可用介面</p> + </th> + <th scope="col">敘述</th> + <th scope="col" style="width: 350px;">範例</th> + </tr> + </thead> + <tbody> + <tr> + <td><a href="/Add-ons/WebExtensions/user_interface/Browser_action">工具列按鈕</a></td> + <td>一個瀏覽器工具列上的按鈕,被點擊時會送出事件給套件。預設的情況下在所有頁籤都能看到此按鈕。</td> + <td><img alt="Example showing a toolbar button (browser action)." src="https://mdn.mozillademos.org/files/15751/browser-action.png" style="height: 364px; width: 700px;"></td> + </tr> + <tr> + <td>附帶<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">彈出視窗</a>的工具列按鈕</td> + <td>一個按鈕上的彈出視窗,當按鈕被點擊時展開。彈出視窗被一個HTML文件來定義。</td> + <td><img alt="Example of the pop-up on a toolbar button" src="https://mdn.mozillademos.org/files/15753/popup-shadow.png" style="height: 624px; width: 700px;"></td> + </tr> + <tr> + <td><a href="/Add-ons/WebExtensions/user_interface/Page_actions">網址列按鈕</a></td> + <td>一個網址列上的按鈕,點擊時傳送事件給套件。預設的情況下,在所有的頁籤中此按鈕都會被隱藏。</td> + <td><img alt="Example showing an address bar button (page action) " src="https://mdn.mozillademos.org/files/15745/address_bar_button.png" style="height: 348px; width: 700px;"></td> + </tr> + <tr> + <td>附帶<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">彈出視窗</a>的網址列按鈕</td> + <td>網址列按鈕上的一個按鈕,當按鈕被點擊時展開,彈出視窗被一個HTML文件來定義。</td> + <td><img alt="Example of a popup on the address bar button" src="https://mdn.mozillademos.org/files/15747/page_action_popup.png" style="height: 524px; width: 700px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items">快捷選單</a></td> + <td>在一個或多個瀏覽器快捷選單中的選單項目、核取方塊、選項按鈕。另外,選單可以透過增加分隔線來組成。當選單項目被點擊時傳送一個事件給套件。</td> + <td><img alt="Example of content menu items added by a WebExtension, from the context-menu-demo example" src="https://mdn.mozillademos.org/files/15756/context_menu_example.png" style="height: 942px; width: 864px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Sidebars">側邊欄</a></td> + <td> + <p dir="ltr">一個顯示在網頁旁邊的HTML文件,每頁可以顯示獨立的內容。側邊欄會在用戶安裝套件時打開,然後根據用戶對側邊欄的可視選項開關。側邊欄裡的用戶互動由它的HTML文件來控制。</p> + </td> + <td><img alt="Example of a sidebar" src="https://mdn.mozillademos.org/files/15755/bookmarks-sidebar.png" style="height: 846px; width: 700px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages">選項頁面</a></td> + <td>一個使你可以定義用戶能修改的偏好設定的頁面。用戶可以透過瀏覽器的套件管理畫面進到這裡。</td> + <td><img alt="Example showing the options page content added in the favorite colors example." src="https://mdn.mozillademos.org/files/15748/options_page.png"></td> + </tr> + <tr> + <td><a href="/Add-ons/WebExtensions/user_interface/Extension_pages">套件頁面</a></td> + <td>透過套件裡的網頁來在視窗或頁籤內提供表單、幫助訊息或任何需要的內容。</td> + <td><img alt="Example of a simple bundled page displayed as a detached panel." src="https://mdn.mozillademos.org/files/15752/bundled_page_as_panel_small.png" style="height: 432px; width: 700px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Notifications">通知</a></td> + <td>透過作業系統的機制顯示的短暫的通知。當用戶點擊通知或通知關閉時(不論自動關閉或用戶手動關閉)時傳送事件給套件。</td> + <td><img alt="Example of an extension triggered system notification" src="https://mdn.mozillademos.org/files/15754/notify-shadowed.png" style="height: 294px; width: 780px;"></td> + </tr> + <tr> + <td><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Omnibox">網址列建議</a></td> + <td>當用戶輸入關鍵字時提供自訂的網址列建議。</td> + <td><img alt="Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions." src="https://mdn.mozillademos.org/files/15749/omnibox_example_small.png" style="height: 464px; width: 700px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels">開發者工具面板</a></td> + <td>一個包含相關HTML文件的頁籤顯示在瀏覽器的開發者工具裡。</td> + <td><img alt="Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions." src="https://mdn.mozillademos.org/files/15746/developer_panel_tab.png" style="height: 224px; width: 700px;"></td> + </tr> + </tbody> +</table> + +<p>下面是一些關於建立這些用戶介面的詳細教學:</p> + +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Add_a_button_to_the_toolbar">在工具列加入一個按鈕</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Implement_a_settings_page">建立設定頁面</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools">擴充開發者工具</a></li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/user_interface/sidebars/index.html b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/sidebars/index.html new file mode 100644 index 0000000000..923cd9d14f --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/user_interface/sidebars/index.html @@ -0,0 +1,55 @@ +--- +title: 側邊欄 +slug: Mozilla/Add-ons/WebExtensions/user_interface/Sidebars +tags: + - 擴充套件 +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Sidebars +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>側邊欄是一個顯示在瀏覽器視窗上、網頁旁邊的面板。瀏覽器提供能讓用戶看見目前可用的側邊欄並且擇一顯示的UI。例如,Firefox 有一個 "檢視 > 側邊欄" 的選單。一次只能有一個側邊欄顯示,而那個側邊欄會顯示在所有的頁籤以及瀏覽器視窗。</p> + +<p>瀏覽器可能包含了一些內建的側邊欄。例如,Firefox 包含了一個可以跟書籤互動的側邊欄:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15755/bookmarks-sidebar.png" style="display: block; height: 423px; margin-left: auto; margin-right: auto; width: 350px;">在 manifest.json 裡用 <code>sidebar_action</code> 鍵可以替瀏覽器添加側邊欄。它會被列在內建的側邊欄旁邊,而用戶可以透過與內建側邊欄一模一樣的機制來打開它。</p> + +<p>就像工具列按鈕一樣,你藉由HTML文件指定側邊欄的內容。當用戶打開側邊欄,側邊欄的文件會被讀取到每個開著的瀏覽器視窗。每個視窗都各自獲取文件的實例,當新的視窗被開啓,他們也會獲取自己的側邊欄實例。</p> + +<p>你可以用{{WebExtAPIRef("sidebarAction.setPanel()")}}函數設置某個頁籤專屬的文件。側邊欄會透過{{WebExtAPIRef("windows.getCurrent()")}} API找出它隸屬的視窗 :</p> + +<pre class="brush: js">// sidebar.js +browser.windows.getCurrent({populate: true}).then((windowInfo) => { + myWindowId = windowInfo.id; +});</pre> + +<p>如果側邊欄要在不同的視窗顯示不同內容這會很有用。範例請看 <a href="https://github.com/mdn/webextensions-examples/tree/master/annotate-page">"annotate-page" 範例</a>。</p> + +<p>側邊欄文件與後端腳本以及彈出視窗享有一樣的權限。他們可以透過{{WebExtAPIRef("runtime.getBackgroundPage()")}}直接讀取後端頁面(只要側邊欄隸屬於隱私模式的視窗),並且可以透過一些 messaging APIs 與內容腳本或原生應用互動,像是{{WebExtAPIRef("tabs.sendMessage()")}}與{{WebExtAPIRef("runtime.sendNativeMessage()")}}。</p> + +<p>側邊欄文件會在瀏覽器視窗關閉或用戶關閉側邊欄時被卸載。這代表不像後端腳本,側邊欄文件並不總是保持讀入的狀態。但是不像工具列按鈕,他們可以在用戶與網頁互動時保持讀入。</p> + +<p>當定義著側邊欄的套件被首次安裝時,側邊欄2會自動開啓。這是爲了幫助用戶瞭解這個套件包含了一個側邊欄。註:套件無法程式化地開啓側邊欄,側邊欄只能由用戶開啓。</p> + +<h2 id="指定側邊欄">指定側邊欄</h2> + +<p>要指定側邊欄,在 manifest.json 裡透過 <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/sidebar_action">sidebar_action</a></code> 鍵定義文件、標題以及圖示:</p> + +<pre class="brush: json">"sidebar_action": { + "default_title": "My sidebar", + "default_panel": "sidebar.html", + "default_icon": "sidebar_icon.png" +}</pre> + +<p>你可以透過{{WebExtAPIRef("sidebarAction")}} API程式化地更改標題、面板以及圖示。</p> + +<p>標題與圖示會在任一個瀏覽器提供的UI中顯示,像是 Firefox 裡的 "檢視 > 側邊欄" 選單。</p> + +<h2 id="側邊欄設計">側邊欄設計</h2> + +<p>更多如何設計符合 Firefox 風格的側邊欄網頁細節,請查看文件<a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">光子設計系統</a>。</p> + +<h2 id="範例">範例</h2> + +<p>GitHub上的 <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> 程式庫包含了建立側邊欄的 <a href="https://github.com/mdn/webextensions-examples/tree/master/annotate-page">annotate-page</a> 範例。</p> +</div> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/what_are_webextensions/index.html b/files/zh-tw/mozilla/add-ons/webextensions/what_are_webextensions/index.html new file mode 100644 index 0000000000..6494e50a5f --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/what_are_webextensions/index.html @@ -0,0 +1,26 @@ +--- +title: 何謂附加元件? +slug: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions +--- +<div>{{AddonSidebar}}</div> + +<div> </div> + +<p>附加元件(Add-ons)擴展並修改了瀏覽器的功能。他們使用標準的網路技術──JavaScript、HTML、以及 CSS、還有一些專用的 JavaScript API──寫成。除此之外,附加元件可以給瀏覽器添加新功能、或是改變特定網站的外觀或內容。</p> + +<p>Firefox的附加元件開發基於能跨瀏覽器的 WebExtensions APIs ,在很大的程度上相容於和 Google Chrome 與 Opera 瀏覽器所支持的 <a class="external external-icon" href="https://developer.chrome.com/extensions">extension API</a> 。大多數情況下,針對這些瀏覽器所撰寫的 Extension <a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/Porting_from_Google_Chrome">只要些許修改</a>就能在 Firefox 或是 Microsoft Edge 執行,也與 <a href="https://developer.mozilla.org/zh-TW/Firefox/Multiprocess_Firefox">multiprocess Firefox</a> 完全相容。</p> + +<p>在過去,你可以使用三種系統開發 Firefox 附加元件: <a href="/zh-TW/Add-ons/Overlay_Extensions">XUL/XPCOM overlays</a>、<a href="/zh-TW/docs/Mozilla/Add-ons/Bootstrapped_extensions">bootstrapped extensions</a>、或是 <a href="/zh-TW/docs/Mozilla/Add-ons/SDK">Add-on SDK</a>。但2017年11月底之後,WebExtensions 將成為唯一開發 Firefox 附加元件的方式,而其他方式會被廢棄。</p> + +<p>如果你有任何想法或問題,甚至是需要協助轉換舊附加元件到新系統,你可以在 <a class="external external-icon" href="https://mail.mozilla.org/listinfo/dev-addons">dev-addons mailing list</a> 或 <a class="external external-icon" href="https://wiki.mozilla.org/IRC">IRC</a> 的 <a href="irc://irc.mozilla.org/webextensions">#webextensions</a> 找到我們。</p> + +<p> </p> + +<h2 id="接下來呢?">接下來呢?</h2> + +<ul> + <li>一些附加元件的範例,請參看 <a href="https://github.com/mdn/webextensions-examples">Example WebExtensions</a>。</li> + <li>學習附加元件的結構,請參看 <a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension">解析 WebExtension</a>.</li> + <li>一個簡單的附加元件開發流程,請參看 <a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension">你的第一個 WebExtension</a>。</li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/your_first_webextension/index.html b/files/zh-tw/mozilla/add-ons/webextensions/your_first_webextension/index.html new file mode 100644 index 0000000000..7e4f37423e --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/your_first_webextension/index.html @@ -0,0 +1,150 @@ +--- +title: 你的第一個 WebExtension +slug: Mozilla/Add-ons/WebExtensions/Your_first_WebExtension +translation_of: Mozilla/Add-ons/WebExtensions/Your_first_WebExtension +--- +<div>{{AddonSidebar}}</div> + +<p>我們會在這篇文章詳細講解 Firefox 的 WebExtension 的製作。這支附加元件會在 "mozilla.org" 網域底下的所有網頁,增加紅色外框。</p> + +<p>範例的原始碼也放在 GitHub 喔:<a href="https://github.com/mdn/webextensions-examples/tree/master/borderify">https://github.com/mdn/webextensions-examples/tree/master/borderify</a>。</p> + +<p>首先勒,你需要 Firefox 45.0 或以上的版本。</p> + +<h2 id="撰寫_WebExtension">撰寫 WebExtension</h2> + +<p>新增一個資料夾,然後進到裡面:</p> + +<pre class="brush: bash">mkdir borderify +cd borderify</pre> + +<h3 id="manifest.json">manifest.json</h3> + +<p>現在新增一個檔案 "manifest.json",直接放在 "borderify" 目錄底下就行,然後把下面的程式碼塞進去:</p> + +<pre class="brush: json">{ + + "manifest_version": 2, + "name": "Borderify", + "version": "1.0", + + "description": "Adds a red border to all webpages matching mozilla.org.", + + "icons": { + "48": "icons/border-48.png" + }, + + "content_scripts": [ + { + "matches": ["*://*.mozilla.org/*"], + "js": ["borderify.js"] + } + ] + +}</pre> + +<ul> + <li>最前面的三個 key:<code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/manifest_version">manifest_version</a></code>、<code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/name">name</a></code>、<code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/version">version</a></code> 必須寫進去,它包含了附加元件的基本詮釋資料(metadata)。</li> + <li><code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/description">description</a></code> 是可選、但最好要有:它會在附加元件管理員內標示。</li> + <li><code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/icons">icons</a></code> 也是可選、但最好要有:它允許附加元件指定圖示、也會在附加元件的管理員顯示。</li> +</ul> + +<p>這裡最有趣的 key 是 <code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code>:它告訴 Firefox 說:符合特定型態的 URL 會載入網頁的腳本。在此我們告訴 Firefox 說:所有由 "mozilla.org" 或其子域名服務的 HTTP 或 HTTPS 頁面,都要載入 "borderify.js"。</p> + +<ul> + <li><a href="/zh-TW/Add-ons/WebExtensions/Content_scripts">深入理解 content script</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Match_patterns">深入理解 about match pattern</a></li> +</ul> + +<div class="warning"> +<p><a href="/zh-TW/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID#When_do_you_need_an_Add-on_ID">某些情況下,你需要給附加元件指定 ID</a>。如果需要指定附加元件 ID,請在 <code>manifest.json</code> 引入 <code><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key,並設定 <code>gecko.id</code> 屬性:</p> + +<pre class="brush: json">"applications": { + "gecko": { + "id": "borderify@example.com" + } +}</pre> +</div> + +<h3 id="iconsborder-48.png">icons/border-48.png</h3> + +<p>附加元件要有一個圖標。它會在附加元件管理員的附加元件清單旁邊列出來。我們的 manifest.json 已經說好了,要在 "icons/border-48.png" 那邊會有個圖標。</p> + +<p>在 "borderify" 目錄下直接建立 "icons" 目錄,並儲存一個叫 "border-48.png" 的圖標檔。你可以用<a href="https://github.com/mdn/webextensions-examples/blob/master/borderify/icons/border-48.png">範例的這張圖標</a>,它是從 Google Material Design 圖標集抓下來的,並使用<a href="https://creativecommons.org/licenses/by-sa/3.0/deed.zh_TW">創用 CC:姓名標示-相同方式分享</a>授權。</p> + +<p>如果你要用自己的圖標,它應該是 48x48 像素。你也可以針對高解析度提供 96x96 像素的圖標,這樣的話它在 manifest.json 會被指定為 <code>icons</code> 物件內的 <code>96</code> property:</p> + +<pre class="brush: json">"icons": { + "48": "icons/border-48.png", + "96": "icons/border-96.png" +}</pre> + +<p>要不然,你也能提供 SVG 檔,它就會等比縮放。</p> + +<ul> + <li><a href="/zh-TW/Add-ons/WebExtensions/manifest.json/icons">深入理解指定圖標。</a></li> +</ul> + +<h3 id="borderify.js">borderify.js</h3> + +<p>最後,新增一個檔案叫 "borderify.js",直接放在 "borderify" 目錄底下即可,然後一樣把下面的 code 塞進去:</p> + +<pre class="brush: js">document.body.style.border = "5px solid red";</pre> + +<p>一旦網址符合 manifest.json 中 content_scripts 所設定的模式,這段 script 就會載入,並且就像該頁自己讀入的程式碼一樣、能夠直接存取該頁上的東西。</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Content_scripts">深入了解 content scripts.</a></li> +</ul> + +<h2 id="測試看看">測試看看</h2> + +<p>首先,仔細檢查這些檔案是否在正確的位置:</p> + +<pre>borderify/ + icons/ + border-48.png + borderify.js + manifest.json</pre> + +<h3 id="安裝">安裝</h3> + +<p>在 Firefox 打開 about:debugging,點選 Load Temporary Add-on 然後選擇你的 manifest.json 檔案:</p> + +<p>{{EmbedYouTube("cer9EUKegG4")}}</p> + +<p>現在這個附加元件就要安裝起來,但它要在你重新啟動 Firefox 後才開始。</p> + +<p>又或者,你可以從命令列利用 <a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext">web-ext</a> 工具執行 WebExtension。</p> + +<h3 id="測試">測試</h3> + +<p>現在去看一下 mozilla.org 還有它下面的所有網頁。你應該會看到有個紅色外框圍繞著網頁。</p> + +<p>{{EmbedYouTube("rxBQl2Z9IBQ")}}</p> + +<div class="note"> +<p>不過,別把這招用在 addons.mozilla.org 上,該網域目前會阻擋 content scripts。</p> +</div> + +<p>再做點小實驗吧。改一下腳本讓外框顏色改變,或是做其他更動。接著存檔,並按下 about:debugging 的 Reload 鍵重啟附加元件。現在你能看到更動了:</p> + +<p>{{EmbedYouTube("NuajE60jfGY")}}</p> + +<ul> + <li><a href="/zh-TW/Add-ons/WebExtensions/Temporary_Installation_in_Firefox">多了解一點附加元件的載入</a></li> +</ul> + +<h2 id="打包並發送">打包並發送</h2> + +<p>想讓別人用你的附加元件,就要把元件遞交給 Mozilla 簽署之。想獲得更多資訊,請參見 <a href="/zh-TW/docs/Mozilla/Add-ons/WebExtensions/Publishing_your_WebExtension">發布你的 WebExtension</a>。</p> + +<h2 id="接下來咧?">接下來咧?</h2> + +<p>現在你針對 Firefox 的 WebExtension 開發有點子的話,來看看:</p> + +<ul> + <li><a href="/zh-TW/Add-ons/WebExtensions/Anatomy_of_a_WebExtension">reading more about the anatomy of WebExtensions</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/Your_second_WebExtension">再寫個更進階的 WebExtension</a></li> + <li><a href="/zh-TW/Add-ons/WebExtensions/API">了解 WebExtensions 所提供的 JavaScript API</a></li> +</ul> diff --git a/files/zh-tw/mozilla/add-ons/webextensions/your_second_webextension/index.html b/files/zh-tw/mozilla/add-ons/webextensions/your_second_webextension/index.html new file mode 100644 index 0000000000..403eff4aa7 --- /dev/null +++ b/files/zh-tw/mozilla/add-ons/webextensions/your_second_webextension/index.html @@ -0,0 +1,368 @@ +--- +title: 你的第二個 WebExtension +slug: Mozilla/Add-ons/WebExtensions/Your_second_WebExtension +translation_of: Mozilla/Add-ons/WebExtensions/Your_second_WebExtension +--- +<p>{{AddonSidebar}}</p> + +<p>假如你已經讀過了 <a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/Your_first_WebExtension">你的第一個 WebExtension</a>,你也已經知道該如何寫一個 extension(外掛),在這篇文章中我們將會教你寫一個稍微複雜一點的 extension,來 demo 一些 API 的使用。</p> + +<p>在這個 extension 中,將會新增一個按鈕到 Firefox 的工具列上,當使用者按下按鈕後,將會顯示一個彈出視窗 (pop-up) 並可選擇一個動物。當使用者選擇了一個動物後,將會在當前的網頁中顯示使用者所選的動物圖片。</p> + +<p>為了實作這個,我們將需要:</p> + +<ul> + <li><strong>定義一個 <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a> 給新增於 Firefox 工具列的按鈕。</strong><br> + 這個按鈕,我們將提供以下功能: + <ul> + <li>按鈕的 icon,命名為 "beasts-32.png"</li> + <li>當按下按鈕時顯示一個彈出視窗 (pop-up),這個 pop-up將會包含 HTML, CSS 和 JavaScript。</li> + </ul> + </li> + <li><strong>定義一個 extension 用的 icon,</strong> 命名為 "beasts-48.png". 此 icon 將會顯示於 Add-ons Manager.</li> + <li><strong>寫一個內容腳本 "beastify.js" ,該檔案會被當前網頁讀取。</strong><br> + 讓網頁顯示所選的動物圖片的程式碼會寫在這裡。</li> + <li><strong>打包所需要的動物圖片,此圖片是用來顯示按下按鈕後顯示於網頁上的。</strong><br> + 為了讓網頁可以取用圖片,我們將會讓這些圖片變成可讓 "網頁存取的資源"。</li> +</ul> + +<p>下面是這次 extension 的流程圖:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/13671/Untitled-1.png" style="display: block; height: 1200px; margin-left: auto; margin-right: auto; width: 860px;"></p> + +<p>這個一個簡單的 extension,但是會教你許多基本的 WebExtensions API 的概念:</p> + +<ul> + <li>新增一個按鈕到工具列</li> + <li>利用 HTML, CSS 和 JavaScript 去定義一個 pop-up</li> + <li>讀取內容腳本到網頁</li> + <li>內容腳本與整個 extension 間的溝通</li> + <li>打包 extension 所需的資源,讓網頁可以存取</li> +</ul> + +<p>也可以在 GitHub 上找到範例的原始碼: <a href="https://github.com/mdn/webextensions-examples/tree/master/beastify">https://github.com/mdn/webextensions-examples/tree/master/beastify</a></p> + +<p>實作這個 extension 前,請先確認你的 Firefox 有 45.0 或更新的版本。</p> + +<h2 id="實作_extension">實作 extension</h2> + +<p>新增一個資料夾,然後進去:</p> + +<pre class="brush: bash notranslate">mkdir beastify +cd beastify</pre> + +<h3 id="manifest.json">manifest.json</h3> + +<p>在資料夾 "beastify" 下新增一個檔案,並命名為 "manifest.json",然後撰寫以下程式碼。</p> + +<pre class="brush: json notranslate">{ + + "manifest_version": 2, + "name": "Beastify", + "version": "1.0", + + "description": "Adds a browser action icon to the toolbar. Click the button to choose a beast. The active tab's body content is then replaced with a picture of the chosen beast. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#beastify", + "homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/beastify", + "icons": { + "48": "icons/beasts-48.png" + }, + + "permissions": [ + "activeTab" + ], + + "browser_action": { + "default_icon": "icons/beasts-32.png", + "default_title": "Beastify", + "default_popup": "popup/choose_beast.html" + }, + + "web_accessible_resources": [ + "beasts/frog.jpg", + "beasts/turtle.jpg", + "beasts/snake.jpg" + ] + +} +</pre> + +<ul> + <li>最前面的三個 key:<code><a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/manifest.json/manifest_version">manifest_version</a></code>、<code><a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/manifest.json/name">name</a></code>、<code><a href="https://developer.mozilla.org/zh-TW/Add-ons/WebExtensions/manifest.json/version">version</a></code> 必須寫進去,它包含了附加元件的基本詮釋資料(metadata)。</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/description">description</a></code> 和 <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/homepage_url">homepage_url</a></code> 為非必要但建議加上:主要在說明該 extension。</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/icons">icons</a></code> 為非必要但建議加上:它允許附加元件指定圖示、也會在附加元件的管理員顯示</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a></code> 列出了該 extension 所需要的權限。這邊我們只會要求 <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#activeTab_permission"><code>activeTab</code> permission</a> 。</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> 定義工具列的按鈕,在這邊我們將會提供三種 key: + <ul> + <li><code>default_icon</code> 為必要的:告訴 button 該使用的 icon 為何</li> + <li><code>default_title</code>為非必要的:該 value 會顯示在 button 的 tip 裡</li> + <li><code>default_popup</code> 如果想要顯示 pop-up,此為必要的 key:此教學中有使用到 pop-up 故為必要的,並將 HTML 檔案指給他。</li> + </ul> + </li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources">web_accessible_resources</a></code> 列出所有希望讓網頁可以存取的檔案。</li> +</ul> + +<p>所有的路徑都會關連到 manifest.json 。</p> + +<h3 id="The_icon">The icon</h3> + +<p>一個 extension 應該要有一個 icon。icon 將會顯示在 Add-ons Manager 的 extension 列表中。(在 Firefox 網址列輸入 "about:addons" 開啟 Add-ons Manager)。</p> + +<p>在 beastify 下建立一個名為 "icons" 的資料夾,並準備一個命名為 "beasts-48.png" 的 icon並存在 "beastify/icons" 的資料夾中(可以使用我們的<a href="https://github.com/mdn/webextensions-examples/blob/master/beastify/icons/beasts-48.png">範例圖檔</a>,圖檔來源:<a href="https://www.iconfinder.com/iconsets/free-retina-icon-set">Free Retina Icon Set</a>,遵照<a href="http://www.aha-soft.com/free-icons/free-retina-icon-set/">使用條款</a>來使用)。並在 manifest.json 裡告訴他要使用 "icons/beasts-48.png" 路徑下的 icon。</p> + +<p>如果你想要使用自己的 icon,icon 大小必須是 48x48 pixels,另外也可使用 96x96 pixel 來支援較高解析度的顯示。</p> + +<pre class="brush: json line-numbers language-json notranslate"><code class="language-json"><span class="key token">"icons":</span> <span class="punctuation token">{</span> + <span class="key token">"48":</span> <span class="string token">"icons/beasts-48.png"</span><span class="punctuation token">,</span> + <span class="key token">"96":</span> <span class="string token">"icons/beasts-96.png"</span> +<span class="punctuation token">}</span></code></pre> + +<h3 id="工具列按鈕The_toolbar_button">工具列按鈕(The toolbar button)</h3> + +<p>工具列按鈕也需要一個 icon,在 manifest.json 裡 "browser_action" 物件中的 "default_icon" 中告訴他要使用 "icons/beasts-32.png" 路徑下的 icon。。</p> + +<p>準備一個命名為 "beasts-32.png" 的 icon,並存在 "beastify/icons" 資料夾中(你可以使用<a href="https://github.com/mdn/webextensions-examples/blob/master/beastify/icons/beasts-32.png">範例圖檔</a>,圖檔來源:<a href="http://www.iconbeast.com/free">IconBeast Lite icon set</a>,遵守<a href="http://www.iconbeast.com/faq/">使用條款</a>來使用)。 </p> + +<p>假設你不使用 pop-up,當按下按鈕的時候就會觸發事件。假如使用 pop-up ,當按下按鈕時並不會觸發事件,取而代之會打開 pop-up。不過這邊我們想要用 pop-up,所以接來下會教你如何新增他。</p> + +<h3 id="The_popup">The popup</h3> + +<p>pop-up 的方法主要是讓使用者可以選擇三個動物中的其中一個。</p> + +<p>在 beastify 下 新增一個名為 "popup" 的資料夾,該資料夾中會包含以下三個檔案:</p> + +<ul> + <li><strong><code>choose_beast.html</code></strong> 定義 pop-up 的顯示的內容文字</li> + <li><strong><code>choose_beast.css</code></strong> 定義 html 裡的 styles </li> + <li><strong><code>choose_beast.js</code></strong> 當使用者選擇動物後實行的腳本內容</li> +</ul> + +<pre class="brush: bash line-numbers language-bash notranslate"><code class="language-bash">mkdir popup +cd popup +touch choose_beast.html choose_beast.css choose_beast.js</code></pre> + +<h4 id="choose_beast.html">choose_beast.html</h4> + +<p>HTML 內容長得像這樣:</p> + +<pre class="brush: html notranslate"><!DOCTYPE html> + +<html> + <head> + <meta charset="utf-8"> + <link rel="stylesheet" href="choose_beast.css"/> + </head> + +<body> + <div id="popup-content"> + <div class="button beast">Frog</div> + <div class="button beast">Turtle</div> + <div class="button beast">Snake</div> + <div class="button reset">Reset</div> + </div> + <div id="error-content" class="hidden"> + <p>Can't beastify this web page.</p><p>Try a different page.</p> + </div> + <script src="choose_beast.js"></script> +</body> + +</html></pre> + +<p>我們在 ID 為 <code>"popup-content"</code> 的 <code><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div"><div></a></code> 元件裡建立了一個包含每種動物選項的元件。當載入 popup 發生問題時,用另外一個 ID 為 <code>"error-content"</code> 且類別定義為 <code>"hidden"</code> 的 <code><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div"><div></a></code> 元件來處理。</p> + +<p>值得注意的是我們在這個檔案裡引用了 CSS 與 JS 檔案,就如同一般網頁。</p> + +<h4 id="choose_beast.css">choose_beast.css</h4> + +<p>CSS 定義了 pop-up 的大小,並確保三個選項有填滿整個 pop-up,並給他們幾個基本的 style:</p> + +<pre class="brush: css notranslate">html, body { + width: 100px; +} + +.button { + margin: 3% auto; + padding: 4px; + text-align: center; + font-size: 1.5em; + cursor: pointer; +} + +.beast:hover { + background-color: #CFF2F2; +} + +.beast { + background-color: #E5F2F2; +} + +.clear { + background-color: #FBFBC9; +} + +.clear:hover { + background-color: #EAEAC9; +} +</pre> + +<h4 id="choose_beast.js">choose_beast.js</h4> + +<p>在 pop-up 的 JavaScript 中,我們監控著 click 事件。當按下其中一個選項後,將會讀取 js 檔到當前的瀏覽器分頁(active_tab)中,當內容腳本被讀取後,將會發送一個訊息告訴他該選擇哪一張圖片。</p> + +<pre class="brush: js notranslate">/* +Given the name of a beast, get the URL to the corresponding image. +*/ +function beastNameToURL(beastName) { + switch (beastName) { + case "Frog": + return browser.extension.getURL("beasts/frog.jpg"); + case "Snake": + return browser.extension.getURL("beasts/snake.jpg"); + case "Turtle": + return browser.extension.getURL("beasts/turtle.jpg"); + } +} + +/* +Listen for clicks in the popup. + +If the click is on one of the beasts: + Inject the "beastify.js" content script in the active tab. + + Then get the active tab and send "beastify.js" a message + containing the URL to the chosen beast's image. + +If it's on a button which contains class "clear": + Reload the page. + Close the popup. This is needed, as the content script malfunctions after page reloads. +*/ + +document.addEventListener("click", (e) => { + if (e.target.classList.contains("beast")) { + var chosenBeast = e.target.textContent; + var chosenBeastURL = beastNameToURL(chosenBeast); + + browser.tabs.executeScript(null, { + file: "/content_scripts/beastify.js" + }); + + var gettingActiveTab = browser.tabs.query({active: true, currentWindow: true}); + gettingActiveTab.then((tabs) => { + browser.tabs.sendMessage(tabs[0].id, {beastURL: chosenBeastURL}); + }); + } + else if (e.target.classList.contains("clear")) { + browser.tabs.reload(); + window.close(); + } +}); +</pre> + +<p>這邊使用了三個 WebExtensions API 的方法:</p> + +<ul> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript">browser.tabs.executeScript</a></code> 讀取內容腳本 "content_scripts/beastify.js" 到當前的瀏覽器分頁裡面</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/query">browser.tabs.query</a></code> 取得當前的瀏覽器分頁</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/sendMessage">browser.tabs.sendMessage</a></code> 送訊息到當前的瀏覽器分頁中正在執行的內容腳本裡(beastify.js)。訊息包含了所選的動物的 URL</li> +</ul> + +<h3 id="內容腳本The_content_script">內容腳本(The content script)</h3> + +<p>在 beastify 下建立一個名為 "content_scripts" 的資料夾,並新增一個命名為 "beastify.js" 的檔案,檔案裡的內容:</p> + +<pre class="brush: js notranslate">/* +beastify(): +* removes every node in the document.body, +* then inserts the chosen beast +* then removes itself as a listener +*/ +function beastify(request, sender, sendResponse) { + removeEverything(); + insertBeast(request.beastURL); + browser.runtime.onMessage.removeListener(beastify); +} + +/* +Remove every node under document.body +*/ +function removeEverything() { + while (document.body.firstChild) { + document.body.firstChild.remove(); + } +} + +/* +Given a URL to a beast image, create and style an IMG node pointing to +that image, then insert the node into the document. +*/ +function insertBeast(beastURL) { + var beastImage = document.createElement("img"); + beastImage.setAttribute("src", beastURL); + beastImage.setAttribute("style", "width: 100vw"); + beastImage.setAttribute("style", "height: 100vh"); + document.body.appendChild(beastImage); +} + +/* +Assign beastify() as a listener for messages from the extension. +*/ +browser.runtime.onMessage.addListener(beastify); +</pre> + +<p>內容腳本中新增了一個 listener ,使其從 extension 可傳送訊息。(具體來說是從 "choose_beast.js" 這邊) ,在 listener 中做了:</p> + +<ul> + <li>removeEverything():移除 <code>document.body</code> 中所有的 element ()</li> + <li>insertBeast(beastURL):新增一個 <code><img></code> element 並告訴它圖片的 URL,並插入到文件中</li> + <li>removeListener(beastify):刪除訊息 listener</li> +</ul> + +<h3 id="The_beasts">The beasts</h3> + +<p>最後,我們需要將動物的照片放進來</p> + +<p>新增一個名為 "beasts" 的資料夾,並把三張動物的圖片放進此資料夾中,請取相對應的檔名。可以使用<a href="https://github.com/mdn/webextensions-examples/tree/master/beastify/beasts">範例圖片</a> ,或從這邊下載:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/11459/frog.jpg" style="display: inline-block; height: 200px; margin: 20px; width: 200px;"><img alt="" src="https://mdn.mozillademos.org/files/11461/snake.jpg" style="display: inline-block; height: 200px; margin: 20px; width: 200px;"><img alt="" src="https://mdn.mozillademos.org/files/11463/turtle.jpg" style="display: inline-block; height: 200px; margin: 20px; width: 200px;"></p> + +<h2 id="Testing_it_out">Testing it out</h2> + +<p>首先,請再三的確認檔案有放到相對應的資料夾中:</p> + +<pre class="notranslate">beastify/ + + beasts/ + frog.jpg + snake.jpg + turtle.jpg + + content_scripts/ + beastify.js + + icons/ + beasts-32.png + beasts-48.png + + popup/ + choose_beast.css + choose_beast.html + choose_beast.js + + manifest.json</pre> + +<p>開啟 Firefox 45.0,並安裝本地的 extensive 到瀏覽器裡。</p> + +<p>在 Firefox 網址列輸入 "about:debugging" ,點選 "Load Temporary Add-on",然後選擇你的 "manifest.json" 檔案。然後應該就會看到 extensive 的 icon 出現在工具列上了:</p> + +<p>{{EmbedYouTube("sAM78GU4P34")}}</p> + +<p>打開一個網頁,點選 icon,選擇一個動物的名字,將會看到網頁內容被動物的圖片取代了:</p> + +<p>{{EmbedYouTube("YMQXyAQSiE8")}}</p> + +<h2 id="透過命令行佈署">透過命令行佈署</h2> + +<p>你可以利用<a href="/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext">web-ext</a>自動化暫時載入。<br> + 試試看:</p> + +<pre class="brush: bash notranslate">cd beastify +web-ext run</pre> diff --git a/files/zh-tw/mozilla/adding_phishing_protection_data_providers/index.html b/files/zh-tw/mozilla/adding_phishing_protection_data_providers/index.html new file mode 100644 index 0000000000..14b56484b5 --- /dev/null +++ b/files/zh-tw/mozilla/adding_phishing_protection_data_providers/index.html @@ -0,0 +1,66 @@ +--- +title: 新增偽造網站清單來源 +slug: Mozilla/Adding_phishing_protection_data_providers +tags: + - 待翻譯 +translation_of: Mozilla/Adding_phishing_protection_data_providers +--- +<p>詐騙網站偵測技術讓 Firefox 能將當前網頁與黑名單兩相比對,藉此得知此網站是否為詐騙網站,並於確認後提醒使用者。</p> + +<h2 id=".E5.AE.89.E8.A3.9D.E6.96.B0.E8.B3.87.E6.96.99.E4.BE.86.E6.BA.90" name=".E5.AE.89.E8.A3.9D.E6.96.B0.E8.B3.87.E6.96.99.E4.BE.86.E6.BA.90">安裝新資料來源</h2> + +<p>要安裝詐騙網站清單的資料來源,必須調整一些相關設定,以便提供資料來源的細節。</p> + +<p>每個資料來源都有其獨一無二的 ID 號碼,而 ID 號碼為 0 者即是 Firefox 出廠時的預設資料來源。當安裝新的資料來源時,你應該指定另一個未使用的號碼。</p> + +<p>要知道哪些號碼能用,必須以迴圈循序取出設定值,例如先是 <code>browser.safebrowsing.provider.0.name</code>、而後為<code>browser.safebrowsing.provider.1.name</code>,以此類推。當取值時無傳回內容,代表這個數字可以用。</p> + +<p>你可以從<a href="zh_tw/%e7%82%ba%e6%93%b4%e5%85%85%e5%a5%97%e4%bb%b6%e6%96%b0%e5%a2%9e%e5%81%8f%e5%a5%bd%e8%a8%ad%e5%ae%9a">為擴充套件新增偏好設定</a>文章中找到讀寫設定值的相關範例。</p> + +<h3 id=".E5.BF.85.E5.82.99.E8.A8.AD.E5.AE.9A" name=".E5.BF.85.E5.82.99.E8.A8.AD.E5.AE.9A">必備設定</h3> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.name</code></dt> + <dd>資料來源的名稱,讓使用者方便識別。</dd> +</dl> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.keyURL</code></dt> + <dd>用來為其他要求編碼的私鑰 URL。</dd> +</dl> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.lookupURL</code></dt> + <dd>The URL to use to look up URLs to see if they're blacklisted. This request must be encrypted using the private key returned by the <code>keyURL</code> request.</dd> +</dl> + +<h3 id=".E9.81.B8.E7.94.A8.E8.A8.AD.E5.AE.9A" name=".E9.81.B8.E7.94.A8.E8.A8.AD.E5.AE.9A">選用設定</h3> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.reportURL</code></dt> + <dd>An URL used for reporting when users visit phishing pages and whether or not they decided to heed the warning or to ignore it.</dd> +</dl> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.updateURL</code></dt> + <dd>An URL used to request an updated list of phishing sites. The server either provides a full list or incremental updates in order to bring the client's tables up to date.</dd> +</dl> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.reportGenericURL</code></dt> + <dd>Not currently used; intended for use in reporting other issues with the phishing protection service.</dd> +</dl> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.reportErrorURL</code></dt> + <dd>An URL to which the user is directed in order to report a safe page that is incorrectly being reported as a phishing site.</dd> +</dl> + +<dl> + <dt><code>browser.safebrowsing.provider.<em>idnum</em>.reportPhishURL</code></dt> + <dd>An URL to which the user is directed in order to report a phishing site that isn't detected by the phishing protection system.</dd> +</dl> + +<h2 id="Determining_the_currently-selected_data_provider" name="Determining_the_currently-selected_data_provider">Determining the currently-selected data provider</h2> + +<p>If you need to determine the ID number of the currently selected anti-phishing data provider, you can look at the current value of the preference <code>browser.safebrowsing.dataProvider</code>.</p> diff --git a/files/zh-tw/mozilla/chrome_registration/index.html b/files/zh-tw/mozilla/chrome_registration/index.html new file mode 100644 index 0000000000..f2cde3f964 --- /dev/null +++ b/files/zh-tw/mozilla/chrome_registration/index.html @@ -0,0 +1,348 @@ +--- +title: Chrome registration +slug: Mozilla/Chrome_Registration +translation_of: Mozilla/Chrome_Registration +--- +<h2 id="What_is_Chrome.3F" name="What_is_Chrome.3F">馬桶裡有個 chrome?</h2> + +<p><a href="/en/Chrome" title="en/Chrome">Chrome</a> 是一拖拉庫在文件 window 範圍之外 AP 視窗的 UI 元件。 管它 Toolbars 、 menu bars、progress bars 還是 window title bars 基本上都是 chrome 的一部份。</p> + +<div class="note"> +<p>Mozilla 會尋找並讀取主題佈景和附加元件根目錄<code>的 chrome.manifest</code> 檔。</p> +</div> + +<div class="note"> +<p>古早的 Gecko 1.9.2 (及更古早版本),Mozilla 是從 AP 讀取<code>chrome/*.manifest</code> 檔。 從 Gecko 2.0 {{ geckoRelease("2.0") }} 開始,就只剩根目錄的 <code>chrome.manifest</code> 還有再用;若要增加更多的內容,就在其中利用 <a href="/en/Chrome_Registration#manifest" title="en/Chrome Registration#manifest"><code>manifest</code></a> 指令來擴充。</p> +</div> + +<h2 id="Chrome_Providers" name="Chrome_Providers">Chrome providers</h2> + +<p>基於某種 window type (例如針對 browser window) 提供 chrome 者稱為 chrome provider。所有的 provider 同心協力針對特定的 window 提供整套的 chrome,從工具列上的圖案到文字或內容描述檔,以及 window 本身的外觀。</p> + +<p>以下是三種基本的 chrome provider :</p> + +<dl> + <dt>Content</dt> + <dd>視窗描述主要是來自於 content provider,格式可以是任何一種 Mozilla 看得懂的類型。通常會是個 XUL file,因為它本來就是專門設計來描述 window 和 dialog 的。用來定義 UI 的 JavaScript 檔也會跟在這包,多數的 XBL binding files 也是。</dd> + <dt>Locale</dt> + <dd>多語系的應用程式會將語系資訊交給 locale providers。醬子譯者就可以翻譯並插進一個另外的 chrome package 而不去更動其它的程式。Java-style properties 檔和 DTD 檔是兩種主要的多語系檔案類型。</dd> + <dt>Skin</dt> + <dd>Skin provider 就負責 chrome 整套外觀的描述檔,通常是 CSS 和圖形。</dd> +</dl> + +<div class="note"> +<p><strong>註:</strong> 從 skin packages 載入的 scripts (包括 <a href="/en/XBL" title="en/XBL">XBL </a>裡的) 並不會執行喔。</p> +</div> + +<h2 id="The_Chrome_Registry" name="The_Chrome_Registry">Chrome 登錄 (chrome registry)</h2> + +<p>Gecko runtime 會保持一份稱為 chrome registry 的記錄,用來對登錄 chrome package 名稱和實際檔案路徑。</p> + +<p>Chrome registry 可以設定並且會保存;且有賴於 xpinstall 和 extension manager,這樣 user 就可以很多套 chrome provider 然後選擇喜歡的語系和外觀。</p> + +<p>XULRunner application、主題布景或附加元件要讓 chrome registry 知道有這麼一個 chrome,那就要在自己的根目錄下放一個 純文字格式的 manifest,也就是 `chrome.manifest`。</p> + +<p>這個純文字的 manifests 是簡單的逐行格式,會被一行一行地解析。 chrome registry 看懂一行就處理一行,看不懂就跳過;當然,有問題的會 log 在 console 中。</p> + +<pre>locale packagename localename path/to/files +skin packagename skinname path/to/files +</pre> + +<p></p><div class="warning">Firefox 2 、 Thunderbird 2 和 SeaMonkey 1.1 無法辨識大小寫夾雜的 <code>packagename</code> 。 要是把範例中的 <code>packagename </code>改成 <strong>C</strong>amel<strong>C</strong>ase<strong>P</strong>ackage 就會跑出類似 "No chrome registered for chrome://<strong>c</strong>amel<strong>c</strong>ase<strong>p</strong>ackage/path/to/files" 的訊息。 Firefox 3 、 Thunderbird 3 還有 SeaMonkey 2 已經支援這個功能。Bug resolved 於 Mozilla 1.9; see {{bug(132183)}}.</div><p></p> + +<h2 id="Manifest_Instructions" name="Manifest_Instructions">Manifest 指令</h2> + +<h3 id="comments" name="comments">comments</h3> + +<p>如果一行的開頭是 '#' 那這整行就變成註解。</p> + +<pre class="eval"># this line is a comment - you can put whatever you want here +</pre> + +<h3 id="manifest" name="manifest">manifest</h3> + +<p>{{ gecko_minversion_inline("2.0b4") }}</p> + +<pre>manifest <em>subdirectory/foo.manifest [flags]</em> +</pre> + +<p>這行會載入另一份 manifest 檔。這在拆分元件、chrome 登錄項或是各平台相依登錄資料時尤其有用。</p> + +<h3 id="binary-component">binary-component</h3> + +<p>{{ gecko_minversion_inline("2.0b2") }}</p> + +<pre>binary-component <em>components/mycomponent.dll [flags]</em> +</pre> + +<p>叫 Mozilla 登錄並應用 binary component,由於 binary components 為 ABI-specific,應與 abi flag 並用。 <a href="/en/XPCOM/XPCOM_changes_in_Gecko_2.0" title="en/XPCOM/XPCOM changes in Gecko 2.0">在 Firefox 4 之前 </a>,components 資料夾裡的檔案會自動被登錄。</p> + +<h3 id="interfaces">interfaces</h3> + +<p>{{ gecko_minversion_inline("2.0b2") }}</p> + +<pre>interfaces <em>component/mycomponent.xpt [flags]</em> +</pre> + +<p>叫 Mozilla 從經由 XPIDL 產生的 typelib 檔載入 interface 資訊。<a href="/en/XPCOM/XPCOM_changes_in_Gecko_2.0" title="en/XPCOM/XPCOM changes in Gecko 2.0">在 Firefox 4 之前</a>,components 資料夾裡的檔案會自動被登錄。</p> + +<h3 id="component">component</h3> + +<p>{{ gecko_minversion_inline("2.0b2") }}</p> + +<pre>component <em>{00000000-0000-0000-0000-000000000000} components/mycomponent.js [flags]</em> +</pre> + +<p>告訴 Mozilla 一個由 XPCOM 元件以 JavaScript (或是其它可接受的 scripting language) 實作之元件的 CID。ClassID {0000 ...} 一定要和該元件所實現的 ClassID 相同。可利用程式或線上 UUID 產生器產生唯一的 ClassID。</p> + +<h3 id="contract">contract</h3> + +<p>{{ gecko_minversion_inline("2.0b2") }}</p> + +<pre>contract <em>@foobar/mycontract;1 <em>{00000000-0000-0000-0000-000000000000} [flags]</em></em> +</pre> + +<p>將特定實作的 contract ID (一個語意化字串) 對應到 ClassID。通常 contract ID 就和它頂頭所列的 component entry 一組。<br> + </p> + +<h3 id="content" name="content" style="min-height: 0;">category</h3> + +<p>{{ gecko_minversion_inline("2.0b2") }}</p> + +<pre>category <em>category entry-name value [flags]</em> +</pre> + +<p>登錄在 <a href="/en/XPCOM_Interface_Reference/nsICategoryManager" title="en/XPCOM Interface Reference/nsICategoryManager">category manager</a> ,至於項目的格式和用意就要看它是哪個 category 了。</p> + +<h3 id="content" name="content" style="min-height: 0;">content</h3> + +<p>下面這行登錄一個 content package :</p> + +<pre>content <em>packagename</em> <em>uri/to/files/</em> <em>[flags]</em> +</pre> + +<p>這會將 package 登錄在一個像 <code>`chrome://<em>packagename</em>/content/..` </code>的位置,也就是之後它被存取的位置。這個 URI 可以是絕對位置或是相對於 manifest file 的位置,但要注意結尾的 '/' 不可省略。</p> + +<h3 id="locale" name="locale">locale</h3> + +<p>下面這行登錄一個 locale package :</p> + +<pre class="eval">locale <em>packagename</em> <em>localename</em> <em>uri/to/files/</em> <em>[flags]</em> +</pre> + +<p>這會將 locale package 登錄在解析 `chrome://<em>packagename</em>/locale/..` 所用的位置。<em> localename</em> 通常直接用語系名稱像是 "zh" 或有時候用 語系-地區 像 "zh-TW"。如果同一 package 有多個語系 chrome registry 會根據使用者偏好中的設定值選擇最接近的語系。</p> + +<h3 id="skin" name="skin">skin</h3> + +<p>下面這行登錄一個 skin package :</p> + +<pre class="eval">skin <em>packagename</em> <em>skinname</em> <em>uri/to/files/</em> <em>[flags]</em> +</pre> + +<p>這會將 skin package 登錄在 <a class="external" rel="freelink">chrome://packagename/skin/</a>.. ,<em> skinname</em> is 是用來識別所安裝 skin 的一個非透明化字串。同樣地,若同一 package 登記了多個 skin , chrome registry 會根據使用者偏好中的設定值選擇最合適的。</p> + +<h3 id="style" name="style">style</h3> + +<p>Style overlay (套用在chrome page上的自訂 CSS) 以下列語法登錄:</p> + +<pre class="eval">style chrome://<em>URI-to-style</em> chrome://<em>stylesheet-URI</em> <em>[flags]</em> +</pre> + +<div class="note">注意: 只有位於 chrome URI 的 stylesheet 可以這樣用。</div> + +<h3 id="override" name="override">override</h3> + +<p>chrome 登錄 manifest 允許 override 指令以便讓某些 extension 或其它嵌入物件可以改寫 XULRunner 或 AP 預設的 chrome file 設定。</p> + +<pre class="eval">override chrome://<em>package</em>/<em>type</em>/<em>original-uri.whatever</em> <em>new-resolved-URI</em> <em>[flags]</em> +</pre> + +<p>注意:override 路徑不會遞迴 (所以將 <a class="external" rel="freelink">chrome://foo/content/bar/</a> override 為 <a class="external" rel="freelink">file:///home/john/blah/</a> 之後,其行為通常不會是預期的那樣)。而且 override 之後路徑是相對於被重寫掉的路徑而不是用來重寫的路徑 (從 CSS 的角度來說,這搞不好是個偏門也搞不好使人抓狂) 。</p> + +<div class="note"> +<p>在 Gecko 1.8.1.5 (Firefox 2.0.0.5) 和較早的版本中有個 <em>new-resolved-URI</em> 參數 只能用絕對路徑而不能用相對路徑的 bug。詳見: {{ Bug(323455) }}.</p> +</div> + +<h3 id="resource" name="resource">resource</h3> + +<p>{{ Fx_minversion_inline("3") }}</p> + +<p>在 extension 和 AP 中使用<a href="/en/Components.utils.import" title="en/Components.utils.import"> Components.utils.import</a> 來載入 <a href="/en/JavaScript_code_modules/Using" title="en/Using_JavaScript_code_modules">JavaScript code modules</a> 時,建立 resource protocol 別名 (aliases) 有時是必須的。請使用 <code>resource</code> 指令來建立別名:</p> + +<pre class="eval">resource <em>aliasname</em> <em>uri/to/files/</em> <em>[flags]</em> +</pre> + +<p>這會將目的路徑對映到 <code>resource://<aliasname><span style="font-family: Verdana,Tahoma,sans-serif;">/</span></code>.. 。</p> + +<div class="note"> +<p><span class="short_text" id="result_box" lang="zh-TW"><span>並</span><span>沒有安全性</span><span>限制防止</span><span>網頁內容</span><span> include 以 resource: 開頭</span><span>的 URI</span><span>,故</span><span>請留意此處所開啟的能見度</span><span>。</span></span></p> +</div> + +<h2 id="Manifest_Flags" name="Manifest_Flags">Manifest 旗號</h2> + +<p>Manifest 指令行允許多個以空白分隔的旗號附加於行尾。這些旗號將會設定 package 中 chrome 的特殊屬性,或限制這些指令行本身於什麼條件下作用。</p> + +<h3 id="application" name="application">application</h3> + +<p>Extension 可以安裝於多個應用程式,而有些 chrome registration 可能只需作用於特定的應用程式。以下旗號</p> + +<pre class="eval">application=<em>app-ID</em> +</pre> + +<p>代表這個指令只應在 extension 安裝於符合 <em>app-ID </em>的應用程式時作用。同一行可以指定多個應用程式,此時只要其中一項符合即會作用。</p> + +<p>以下示範如何為多個應用程是分別指定 overlay :</p> + +<pre>overlay chrome://browser/content/browser.xul chrome://myaddon/content/ffOverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6} +overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://myaddon/content/sbOverlay.xul application=songbird@songbirdnest.com +</pre> + +<h3 id="appversion" name="appversion">appversion</h3> + +<p>Extension 可以安裝於同一應用程式的多個不同版本,而有些 chrome registration 可能只需作用於特定的版本。以下旗號</p> + +<pre class="eval">appversion=<em>version</em> +appversion<<em>version</em> +appversion<=<em>version</em> +appversion><em>version</em> +appversion>=<em>version</em> +</pre> + +<p>代表這個指令只應在 extension 安裝於符合特定版本的應用程式時作用。同一行可以指定多個 <code>appversion</code> ,此時只要其中一項符合即會作用。版本字串應遵循 <a href="/en/Toolkit_version_format" title="en/Toolkit_version_format">Toolkit version format</a> 。</p> + +<div class="note"> +<p>Gecko 在 1.8.0.13 之前以及版本 1.8.1.5 有一個 bug , 就是本字串必須超過一個字元(也就是最少兩個) 才能使用 < 、 > 及 =,否則會在 console 中收到<code> appversion</code> flag was not recognized 的錯誤訊息。參見: {{ Bug(380398) }} 。</p> +</div> + +<h3 id="platformversion" name="platformversion">platformversion</h3> + +<p>{{ gecko_minversion_inline("8.0") }} 當附加元件尤其是 binary components支援一種以上的應用程式時,若能指定所相容的 Gecko 版本將為其帶來更多的方便性。若某些 chrome registration 只作用於定特定 Gecko 版本,以下旗號</p> + +<pre class="eval">platformversion=<em>version</em> +platformversion<<em>version</em> +platformversion<=<em>version</em> +platformversion><em>version</em> +platformversion>=<em>version</em> +</pre> + +<p>代表這個指令只應在 extension 安裝於符合特定 Gecko 版本的應用程式時作用。同一行可以指定多個 <code>platformversion</code>,此時只要其中一項符合即會作用。</p> + +<h3 id="contentaccessible" name="contentaccessible">contentaccessible</h3> + +<p>{{ Fx_minversion_inline("3") }} Chrome resources 已不能被非信任來源內容中的 <img>、<script> 及其他包含或添加的 elements 所參照。 這個限制不僅適用於非信任來源中所定義的 elements , 同時也適用於受信任的附加元件中所定義的 elements。若參照需要明確地被允許,請將 <code>contentaccessible</code> 旗號設定為 <code>yes</code> 來達到如舊版 Firefox 中的行為。 <span class="comment">See {{ bug("4369")}}</span></p> + +<p><code>contentaccessible</code> 只能用於 content package ,言下之意,它不會被 locale 或 skin registration 所識別。好在於 content package 所對應到的 locale 和 skin packages 對 content 而言是可見的。</p> + +<p>注意:由於舊版的 Firefox 根本看不懂 <code>contentaccessible</code> flag , 若要讓附加元件同時支援 Firefox 3 及古董版的話就得來個倒退嚕,您倒是看看:</p> + +<pre>content packagename chrome/path/ +content packagename chrome/path/ contentaccessible=yes +</pre> + +<h3 id="os" name="os">os</h3> + +<p>{{ Fx_minversion_inline("3") }} Extensions (or themes) may offer different features depending on the operating system on which Firefox is running. The value is compared to the value of <a href="/en/OS_TARGET" title="en/OS_TARGET">OS_TARGET</a> for the platform.</p> + +<pre class="eval">os=WINNT +os=Darwin +</pre> + +<p>See <a href="/en/OS_TARGET" title="en/OS_TARGET">OS_TARGET</a> for a more complete list of os names. The os name is case insensitive.</p> + +<h3 id="osversion" name="osversion">osversion</h3> + +<p>{{ Fx_minversion_inline("3") }} An extension or theme may need to operate differently depending on which version of an operating system is running. For example, a theme may wish to adopt a different look on Mac OS X 10.5 than 10.4:</p> + +<pre class="eval">osversion>=10.5 +</pre> + +<h3 id="platform_.28Platform-specific_packages.29" name="platform_.28Platform-specific_packages.29">abi</h3> + +<p>{{ Fx_minversion_inline("4") }} If a component is only compatible with a particular ABI, it can specify which ABI/OS by using this directive. The value is taken from the <a href="/en/XPCOM_Interface_Reference/nsIXULRuntime" title="https://developer.mozilla.org/en/nsIXULRuntime">nsIXULRuntime</a> OS and XPCOMABI values (concatenated with an underscore). For example:</p> + +<pre>binary-component component/myLib.dll abi=WINNT_<code>x86-MSVC +</code>binary-component component/myLib.so abi=Linux_<code>x86-gcc3 </code> +</pre> + +<p>See <a href="/en/XPCOM_ABI" title="en/XPCOM ABI">XPCOM ABI</a> for more details.</p> + +<h3 id="platform_.28Platform-specific_packages.29" name="platform_.28Platform-specific_packages.29">platform (Platform-specific packages)</h3> + +<p>Some packages are marked with a special flag indicating that they are platform specific. Some parts of content, skin, and locales may be different based on the platform being run. These packages contain three different sets of files, for Windows and OS/2, Macintosh, and Unix-like platforms. For example, the order of the "OK" and "Cancel" buttons in a dialog is different, as well as the names of some items.</p> + +<p>The "platform" modifier is only parsed for content registration; it is not recognized for locale or skin registration. However, it applies to content, locale, and skin parts of the package, when specified.</p> + +<p>To indicate that a package is platform-specific, add the "platform" modifier to the "content" line after the path, for example:</p> + +<pre class="eval">content global-platform jar:toolkit.jar!/toolkit/content/global-platform/ platform +</pre> + +<p>Once that is specified in your manifest you then ensure that under the directory global-platform are subdirectories <code>win</code> (Windows/OS2), <code>mac</code> (OS9/OSX), or <code>unix</code> (Everything Else). Anything residing outside of these subdirectories will be ignored.</p> + +<h3 id="xpcnativewrappers" name="xpcnativewrappers">xpcnativewrappers</h3> + +<p>Chrome packages can decide whether to use the <a href="/en/XPCNativeWrapper" title="en/XPCNativeWrapper">XPCNativeWrapper</a> security mechanism to automatically protect their code against malicious content that they might access. See <a href="/en/Safely_accessing_content_DOM_from_chrome" title="en/Safely_accessing_content_DOM_from_chrome">Safely accessing content DOM from chrome</a> for details.</p> + +<p>This flag is enabled by default since Firefox 1.5. Disabling it manually was possible by specifying <code>xpcnativewrappers=no</code> until Firefox 4.</p> + +<div class="geckoVersionNote"> +<p>{{ gecko_callout_heading("2.0") }}</p> + +<p>Support for this flag has been removed in Gecko 2.0 {{ geckoRelease("2.0") }}. You can no longer disable <code>XPCNativeWrapper</code>s. To update your add-on to work without this flag:</p> + +<ul> + <li>If your add-on depends upon XBL bindings attached to content objects (that is, it needs to be able to call functions or get and set properties created by the XBL binding), you'll need to use the object's <a href="/en/wrappedJSObject" title="en/wrappedJSObject"><code>wrappedJSObject</code></a> property to obtain a wrapped object.</li> + <li>If you need to call functions or access properties defined by the content -- for example, if your add-on wants to add a button to the page that calls a JavaScript function defined by the page.</li> +</ul> +</div> + +<p>The <code>xpcnativewrappers</code> flag applies only to content packages; it is not recognized for locale or skin registration.</p> + +<h2 id="Example_Chrome_Manifest" name="Example_Chrome_Manifest">Example chrome manifest</h2> + +<pre class="eval">content necko jar:comm.jar!/content/necko/ +locale necko en-US jar:en-US.jar!/locale/en-US/necko/ +content xbl-marquee jar:comm.jar!/content/xbl-marquee/ +content pipnss jar:pipnss.jar!/content/pipnss/ +locale pipnss en-US jar:en-US.jar!/locale/en-US/pipnss/ +# Firefox-only +overlay <a class="external" rel="freelink">chrome://browser/content/pageInfo.xul</a> <a class="external" rel="freelink">chrome://pippki/content/PageInfoOverlay.xul</a> application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +# SeaMonkey-only +overlay <a class="external" rel="freelink">chrome://navigator/content/pageInfo.xul</a> <a class="external" rel="freelink">chrome://pippki/content/PageInfoOverlay.xul</a> application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} +overlay <a class="external" rel="freelink">chrome://communicator/content/pref/preftree.xul</a> <a class="external" rel="freelink">chrome://pippki/content/PrefOverlay.xul</a> +content pippki jar:pippki.jar!/content/pippki/ +locale pippki en-US jar:en-US.jar!/locale/en-US/pippki/ +content global-platform jar:toolkit.jar!/content/global-platform/ platform +skin global classic/1.0 jar:classic.jar!/skin/classic/global/ +override <a class="external" rel="freelink">chrome://global/content/netError.xhtml</a> jar:embedder.jar!/global/content/netError.xhtml +content inspector jar:inspector.jar!/content/inspector/ +</pre> + +<h2 id="Instructions_supported_in_bootstrapped_add_ons" name="Instructions_supported_in_bootstrapped_add_ons">Instructions supported in bootstrapped add-ons</h2> + +<p>The following instructions are supported in <a href="/en/Extensions/Bootstrapped_extensions" title="en/Extensions/Bootstrapped extensions">Bootstrapped extensions</a>:</p> + +<ul> + <li><code>manifest</code></li> + <li><code>content</code></li> + <li><code>locale</code></li> + <li><code>skin</code></li> + <li><code>override</code></li> +</ul> + +<h2 id="Debugging_a_Chrome_Manifest_file" name="Debugging_a_Chrome_Manifest_file">Debugging a chrome manifest file</h2> + +<p>The <a class="link-https" href="https://addons.mozilla.org/firefox/addon/chrome-list">Chrome List</a> extension (for Firefox 3.6 and older) shows all registered chrome. This is very helpful when trying to write a <code>chrome.manifest</code> file as you can inspect where the files are being mapped from (jar files, local directory, etc.)</p> + +<h2 id="Old-style_contents.rdf_manifests" name="Old-style_contents.rdf_manifests">Old-style contents.rdf manifests</h2> + +<p>Before the plaintext manifests were introduced (which happened in Firefox 1.5, Toolkit 1.8), RDF manifests named "contents.rdf" were used to register chrome. This format is deprecated; however, SeaMonkey versions before version 2 do not support the plaintext manifest format yet, so <code>contents.rdf</code> manifests are required for extensions that wish to maintain backwards compatibility with Firefox 1.0 or the suite.</p> + +<p>{{ gecko_minversion_note("1.9.2", "The <code>contents.rdf</code> manifest format is no longer supported at all starting with Gecko 1.9.2; add-ons already installed using this format will continue to work but can no longer be installed. Be sure to remove your add-on and reinstall it to ensure that it installs correctly after updating it to use a plaintext manifest.") }}</p> + +<h2 id="Official_References_for_Toolkit_API" name="Official_References_for_Toolkit_API">Official references for <a href="/en/Toolkit_API" title="en/Toolkit_API">Toolkit API</a></h2> + +<p>{{ page("en-US/docs/Toolkit_API/Official_References") }}</p> + +<p>{{ languages( { "fr": "fr/Enregistrement_chrome", "ja": "ja/Chrome_Registration", "pl": "pl/Rejestracja_Chrome" ,"zh-cn":"zh-cn/Chrome_Registration"} ) }}</p> diff --git a/files/zh-tw/mozilla/connect/index.html b/files/zh-tw/mozilla/connect/index.html new file mode 100644 index 0000000000..2e7b782447 --- /dev/null +++ b/files/zh-tw/mozilla/connect/index.html @@ -0,0 +1,126 @@ +--- +title: Connect with Mozilla +slug: Mozilla/Connect +tags: + - 繁體中文TW +translation_of: Mozilla/Connect +--- +<div class="summary"> +<p><span class="seoSummary">Enable, inspire and collaborate to make the Web the primary platform used to create experiences across all connected devices.</span></p> +</div> + +<div> +<div class="column-container dev-program-callouts dev-program-block dev-program-first dev-program-column-wrapper"> +<div class="dev-program-callout"> +<div class="callout-link-container"> +<h2 id="Hacks_部落格">Hacks 部落格</h2> + +<p>A key resource for people developing for the Open Web, the Mozilla Hacks blog offers news and discussion of the latest in Web technologies and browser features.</p> + +<div class="callout-link-wrapper"><a class="callout-link ignore-external" href="https://hacks.mozilla.org/" style="white-space: normal;">立刻閱讀 </a></div> +</div> +</div> + +<div class="dev-program-callout"> +<div class="callout-link-container"> +<h2 id="回饋頻道">回饋頻道</h2> + +<p>Do you have a <a href="http://mzl.la/devtools">great idea for the Developer Tools</a> in Firefox or <a href="http://mzl.la/openwebapps">how Open Web Apps should work</a>? Let us know and help shape the future features!</p> + +<p>Building things and need help? Ask away on Stack Overflow!<br> + <span class="smaller"><strong>{{anch("Developer discussions", "Search the Q&A below")}}</strong></span></p> + +<div class="callout-link-wrapper"><a class="callout-link ignore-external" href="http://stackoverflow.com/r/mozilla" style="white-space: normal;">Stack Overflow 上的 Mozilla 問與答 </a></div> +</div> +</div> + +<div class="dev-program-callout"> +<div class="callout-link-container"> +<h2 id="加入_MDN">加入 MDN</h2> + +<p>Sign up for MDN! You will able to <a href="/en-US/docs/MDN/Contribute">edit the documentation</a> here, create a profile to show off your work, and get access to features over time as we roll them out.</p> + +<div class="callout-link-wrapper"><a class="callout-link" href="/profile/edit" style="white-space: normal;">加入或登入 </a></div> +</div> +</div> +</div> + +<div class="dev-program-explanation dev-program-block"> +<h2 id="與_Mozilla_連結">與 Mozilla 連結</h2> + +<p>Developers are creating the future by building services and apps for people all over the world. The goal of Mozilla Developer Relations is to help developers to use open and standardized web technologies to succeed in achieving their goals. In addition to the documentation here on MDN, we offer help and other resources towards this goal, through various channels. We invite you to connect, learn, and share your own knowledge.</p> + +<p>We are offering help through <a href="http://stackoverflow.com/r/mozilla">Q&A on Stack Overflow</a>, to solve specific technical issues and challenges you might have. We also have a newsletter keeping you informed on the latest happenings in the web scene around web apps and more. <a href="https://marketplace.firefox.com/developers/#newsletter-signup">Subscribe to the Apps & Hacks newsletter.</a></p> + +<p>If you share Mozilla's <a href="https://www.mozilla.org/en-US/mission/">mission</a> and <a href="https://www.mozilla.org/en-US/about/manifesto/">principles</a>, and want to help spread them to more developers, check out the ways you can <a href="https://wiki.mozilla.org/Engagement/Developer_Engagement/Technical_Evangelism/Get_Involved">get involved with technical evangelism</a>, and join our <a href="https://lists.mozilla.org/listinfo/evangelism">evangelism discussion group</a>.</p> + +<p>We have a lot of plans and ideas for iteratively expanding our Developer Relations offerings, and we want you involved as we do so! So, <a href="http://stackoverflow.com/r/mozilla">follow the tags on Stack Overflow</a>, <a href="https://hacks.mozilla.org/">subscribe to the Hacks blog</a>, <a href="https://marketplace.firefox.com/developers/#newsletter-signup">subscribe to the newsletter, </a>and <a href="/profile/edit">sign up for an account</a>!</p> + +<h2 id="加入_Mozilla" style="line-height: 30px;">加入 Mozilla</h2> + +<p><span style="line-height: 1.5;">If you want to go beyond <em>connecting</em> with Mozilla, you can <em>join</em> Mozilla and help realize <a href="https://www.mozilla.org/mission/">Mozilla's mission of building a better Internet</a>. As a developer, you have skills to contribute in many areas, as well as the opportunity to enhance your skills. Mozilla is an open source project, so we "default to open." You can "view source" and contribute to our software development projects, like the Firefox browser for desktop and Android, Firefox OS, and Mozilla's own websites. You can become part of an international community and get recognition for your efforts. Here are some of the advantages of contributing to the Mozilla project.</span></p> + +<h3 id="學習新東西的機會"><strong>學習新東西的機會 </strong></h3> + +<div> +<p><span style="line-height: 1.5;">In writing code for an open source project, you may face problems you have not encountered before, which present learning opportunities for you. You can try out new tools and techniques in an open source project. For example, if you've never done any unit testing, and cannot get permission from your boss to do so in your regular job, writing some code for an open source project would be an excellent place to try it out. Contributing to open source gives you the opportunity to collaborate with and get to know many people around the world who have similar interests. Moreover, an open source organization like Mozilla has many contributors who can help you in solving problems you encounter.</span> If you're just getting started contributing, you can look for "mentored" bugs, where an experienced contributor has offered to help a newcomer fix them.</p> + +<h3 id="我可以從貢獻中得到什麼?"><strong>我可以從貢獻中得到什麼? </strong></h3> + +<p><span style="line-height: 1.5;">Exploring many things and getting recognition in the community -- these are the intangible benefits of contributing to Mozilla. While we can't guarantee specific tangible benefits, many valued contributors receive free Mozilla gear and invitations to Mozilla-related events, and are first in line to be considered for internships. Moreover, your experience in contributing to an open source project might help you find a job. </span><span style="line-height: 1.5;">More and more employers of developers are looking at open source contributions. They like to see that you're blogging and contributing to mailing lists, and they really like to see you listed as a committer on an open source project. It can also help with the work experience section of your resume. </span></p> + +<h3 id="我可以如何貢獻_Mozilla?"><strong>我可以如何貢獻 Mozilla? </strong></h3> + +<p><span style="line-height: 1.5;">There are many project area for which you can contribute to Mozilla. You can find a current, complete list on the main Mozilla <a href="https://www.mozilla.org/contribute">Get Involved</a> page. Some areas that may interest you as a developer include:</span></p> + +<ul> + <li><a href="http://www.whatcanidoformozilla.org/">Coding</a></li> + <li><a href="http://www.whatcanidoformozilla.org/">Web development</a></li> + <li><a href="/en-US/Firefox_OS/Developing_Gaia">Firefox OS</a></li> + <li><a href="https://quality.mozilla.org/teams/">QA</a></li> + <li><a href="https://wiki.mozilla.org/Marketplace/Contributing/Addons">Add-ons</a></li> + <li><a href="https://wiki.mozilla.org/Marketplace/Contributing/Apps">Apps</a></li> + <li><a href="/en-US/docs/MDN/Getting_started">Developer documentation (here on MDN)</a></li> +</ul> +</div> +</div> + +<div class="column-container dev-program-block"> +<div class="column-half" id="Developer_discussions"> +<h2 id="Stack_Overflow_上的問與答_查看所有_QA…">Stack Overflow 上的問與答 <a class="heading-link" href="http://stackoverflow.com/r/mozilla">查看所有 Q&A…</a></h2> + +<p>We have Q&A to discuss challenges and issues when developing, in particular for Firefox OS and the Open Web on mobile. It's available on Stack Overflow under the easy URL <a href="http://stackoverflow.com/r/mozilla">http://stackoverflow.com/r/mozilla</a>.</p> + +<div class="stack-form">Stack form</div> + +<h3 id="最新_QA_主題">最新 Q&A 主題</h3> +</div> + +<div class="column-half dev-program-hacks dev-program-block"> </div> +</div> + +<p class="dev-program-block"><img alt="Developers at a Firefox OS workshop in Madrid." src="https://mdn.mozillademos.org/files/7479/PhonesUp.jpg" style="display: block; height: 359px; margin: 0px auto; max-width: 100%; width: 720px;"></p> + +<div class="column-container dev-program-block"> +<div class="column-7 dev-program-events"> +<h2 id="Mozilla_在哪裡?_在活動頁面上查看訪客與詳細說明…">Mozilla 在哪裡? <a class="heading-link" href="https://developer.mozilla.org/en/events">在活動頁面上查看訪客與詳細說明… </a></h2> + +<p>Here is a listing of events where Mozilla representatives will be speaking. Make sure to talk to them!</p> +</div> + +<div class="column-5"> +<h2 id="其他資源">其他資源</h2> + +<ul class="no-bullets"> + <li><a href="http://www.youtube.com/user/mozhacks">Mozilla Hacks on YouTube</a> + + <ul> + <li><a href="http://www.youtube.com/playlist?list=PLo3w8EB99pqIHIUUv08hBCHq1OgPKhdo0">Firefox OS videos</a></li> + <li><a href="http://www.youtube.com/playlist?list=PLo3w8EB99pqLZNY22xKbTEzMfYo9PXAlm">Firefox Developer Tools videos</a></li> + </ul> + </li> + <li><a href="https://twitter.com/mozhacks">@mozhacks on Twitter</a></li> +</ul> +</div> +</div> +</div> diff --git a/files/zh-tw/mozilla/creating_mozsearch_plugins/index.html b/files/zh-tw/mozilla/creating_mozsearch_plugins/index.html new file mode 100644 index 0000000000..d41978c6ee --- /dev/null +++ b/files/zh-tw/mozilla/creating_mozsearch_plugins/index.html @@ -0,0 +1,56 @@ +--- +title: 製作 MozSearch 搜尋模組 +slug: Mozilla/Creating_MozSearch_plugins +tags: + - 搜尋模組 +translation_of: Mozilla/Creating_MozSearch_plugins +--- +<p>Firefox 2 使用簡化的 <a class="external" href="http://opensearch.org/">OpenSearch</a> 格式儲存搜尋模組,而 MozSearch 搜尋模組則是描述搜尋引擎、URL 及相關參數的 XML 檔。 +</p> +<div class="warning"><b>警告:</b>MozSearch 並非標準格式,也只應於 Mozilla 專案內部使用。除非要包裝在 <a href="zh_tw/Bundles#Application-specific_Extension_Files">Firefox 擴充套件</a>中或直接與 Firefox 安裝檔一起發佈,否則不該使用這種格式。要製作能由網頁安裝的搜尋模組,請參考<a href="zh_tw/%e8%a3%bd%e4%bd%9c_OpenSearch_%e6%90%9c%e5%b0%8b%e6%a8%a1%e7%b5%84">製作 OpenSearch 搜尋模組</a>。</div> +<h2 id=".E6.90.9C.E5.B0.8B.E6.A8.A1.E7.B5.84.E6.AA.94" name=".E6.90.9C.E5.B0.8B.E6.A8.A1.E7.B5.84.E6.AA.94">搜尋模組檔</h2> +<p>MozSearch 格式檔與 <a href="zh_tw/%e8%a3%bd%e4%bd%9c_OpenSearch_%e6%90%9c%e5%b0%8b%e6%a8%a1%e7%b5%84">OpenSearch</a> 格式很像,只是根元素及 XML 名稱空間不同。 +</p> +<h2 id=".E7.AF.84.E4.BE.8B.EF.BC.9AYahoo.21_.E6.90.9C.E5.B0.8B" name=".E7.AF.84.E4.BE.8B.EF.BC.9AYahoo.21_.E6.90.9C.E5.B0.8B">範例:Yahoo! 搜尋</h2> +<p>下列 XML 是內建於英文版 Firefox 2 的 Yahoo! 搜尋模組: +</p> +<pre><SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/"> +<ShortName>Yahoo</ShortName> +<Description>Yahoo Search</Description> +<InputEncoding>UTF-8</InputEncoding> +<Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJECAP8AAAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+py+0NogQuyBDEnEd2kHkfFWUamEzmpZSfmaIHPHrRguUm/fT+UwAAOw==</Image> +<Url type="application/x-suggestions+json" method="GET" + template="http://ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}" /> +<Url type="text/html" method="GET" template="http://search.yahoo.com/search"> + <Param name="p" value="{searchTerms}"/> + <Param name="ei" value="UTF-8"/> + + <MozParam name="fr" condition="pref" pref="yahoo-fr" /> +</Url> +<SearchForm>http://search.yahoo.com/</SearchForm> +</SearchPlugin> +</pre> +<p>假設使用者選擇 Yahoo! 搜尋模組,然後在搜尋欄內輸入「mozilla」後按下 Enter 鍵。接著 Firefox 會依據上面的搜尋模組敘述前往這個搜尋 URL: +</p> +<pre class="eval"><span class="nowiki">http://search.yahoo.com/search?p=mozilla&ei=UTF-8&fr=moz2</span> +</pre> +<p>若使用者只單純按下搜尋欄的放大鏡圖示,或者在搜尋欄隱藏時點選「工具>網路搜尋」,則瀏覽器會前往 <code><SearchForm></code> 指定的 <tt><span class="nowiki">http://search.yahoo.com/</span></tt>。 +</p> +<h2 id=".E7.AF.84.E4.BE.8B.EF.BC.9A.E6.90.9C.E5.B0.8B_MDC" name=".E7.AF.84.E4.BE.8B.EF.BC.9A.E6.90.9C.E5.B0.8B_MDC">範例:搜尋 MDC</h2> +<p>此搜尋模組能協助你輕鬆搜尋 Mozilla 開發者中心英文版的文件: +</p> +<pre><SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/"> +<ShortName>MDC</ShortName> +<Description>Mozilla Developer Center search</Description> +<InputEncoding>UTF-8</InputEncoding> +<Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz%2F%2Fz8DJQAggJiQOe%2Ffv2fv7Oz8rays%2FN%2BVkfG%2FiYnJfyD%2F1%2BrVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw%2F8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi%2FG%2BQKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo%2BMXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia%2BCuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq%2FvLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg%2FkdypqCg4H8lUIACnQ%2FSOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD%2BaDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg%3D%3D</Image> +<Url type="text/html" method="GET" template="http://developer.mozilla.org/en/docs/Special:Search?search={searchTerms}"/> +<SearchForm>http://developer.mozilla.org/en/docs/Special:Search</SearchForm> +</SearchPlugin> +</pre> +<p>這個範例中單純將參數加到 URL 中,而不是使用 <code><Param></code> 指定參數。這也是使用 <code>GET</code> 時的建議做法,而 <code><Param></code> 應於以 <code>POST</code> 方式傳送表單時才使用。 +</p> +<h2 id=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80" name=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80">延伸閱讀</h2> +<ul><li><a href="zh_tw/%e8%a3%bd%e4%bd%9c_OpenSearch_%e6%90%9c%e5%b0%8b%e6%a8%a1%e7%b5%84#.E9.99.A4.E9.8C.AF.E6.8A.80.E5.B7.A7">搜尋模組除錯技巧</a> +</li></ul> +{{ languages( { "ca": "ca/Creaci\u00f3_de_connectors_MozSearch", "en": "en/Creating_MozSearch_plugins", "es": "es/Creaci\u00f3n_de_plugins_MozSearch", "fr": "fr/Cr\u00e9ation_de_plugins_MozSearch", "ja": "ja/Creating_MozSearch_plugins", "it": "it/Creare_Plugin_MozSearch", "pl": "pl/Tworzenie_wtyczek_MozSearch" } ) }} diff --git a/files/zh-tw/mozilla/developer_guide/index.html b/files/zh-tw/mozilla/developer_guide/index.html new file mode 100644 index 0000000000..ea630bbd6b --- /dev/null +++ b/files/zh-tw/mozilla/developer_guide/index.html @@ -0,0 +1,92 @@ +--- +title: 開發者指南 +slug: Mozilla/Developer_guide +tags: + - Developing Mozilla + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Developer_guide +--- +<p>不管你是老手或新手,你會發現這個頁面的文章都能在你著手進行Mozilla開發時給你幫助</p> + +<h2 id="首次使用">首次使用?</h2> + +<dl> + <dt><a href="/en-US/docs/Introduction" title="Introduction">準備開始</a></dt> + <dd>一步一步引領你進入Mozilla的新手指南。</dd> +</dl> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="文件主題">文件主題</h2> + + <dl> + <dt><a class="internal" href="/en-US/docs/Developer_Guide/Source_Code" title="en-US/docs/Developer_Guide/Source_Code">使用Mozilla原始碼</a></dt> + <dd>程式概要,如何取得程式碼以及編程風格指南。</dd> + <dt><a class="internal" href="/en-US/docs/Developer_Guide/Build_Instructions" title="en-US/docs/Developer_Guide/Build_Instructions">建構說明</a></dt> + <dd>如何建立 Firefox, Thunderbird, SeaMonkey, 或其他 Mozilla 應用程式.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Development_process_overview" title="en-US/docs/Developer Guide/Development process overview">開發過程概要</a></dt> + <dd>Mozilla 開發過程概要.</dd> + <dt><a href="/en-US/docs/Mozilla/Multiple_Firefox_Profiles" title="en-US/docs/Mozilla/Multiple_Firefox_Profiles">管理數個文件</a></dt> + <dd>作業於 Firefox 先行釋出的版本時,通常有數個Firefox文件是有幫助的,例如每個通道配置一個文件,或者針對不同的測試有不同的文件。</dd> + <dt><a class="internal" href="/en-US/docs/Mozilla_automated_testing" title="en-US/docs/Mozilla automated testing">Automated Testing</a></dt> + <dd>How to run Mozilla's automated tests, and how to write new tests.</dd> + <dt><a class="internal" href="/en-US/docs/Developer_Guide/How_to_Submit_a_Patch" title="en-US/docs/Getting your patch in the tree">How to submit a patch</a></dt> + <dd>After getting your patch written, you need to get it checked into the tree. This article explains the review process and how to get your patch approved.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Getting_documentation_updated" title="en-US/docs/Developer_Guide/Getting documentation updated">Getting documentation updated</a></dt> + <dd>How to ensure that documentation is kept up to date as you develop.</dd> + <dt><a class="internal" href="/en-US/docs/Mozilla_Modules_and_Module_Ownership" title="en-US/docs/Mozilla Modules and Module Ownership">Mozilla modules and module ownership</a></dt> + <dd>This article provides information about Mozilla's modules, what the role of a module owner is, and how module owners are selected.</dd> + <dt><a class="internal" href="/en-US/docs/Code_snippets" title="en-US/docs/Code_snippets">Code snippets</a></dt> + <dd>Useful code samples for a wide variety of things you might need to figure out how to do.</dd> + <dt><a class="internal" href="/en-US/docs/Mozilla_Development_Strategies" title="en-US/docs/Mozilla Development Strategies">Mozilla development strategies</a></dt> + <dd>Tips for how to make the most of your time working on the Mozilla project.</dd> + <dt><a class="internal" href="/en-US/docs/Debugging" title="en-US/docs/Debugging">Debugging</a></dt> + <dd>Find helpful tips and guides for debugging Mozilla code.</dd> + <dt><a href="/en-US/docs/Performance" title="en-US/docs/Performance">Performance</a></dt> + <dd>Performance guides and utilities to help you make your code perform well (and to play nicely with others).</dd> + <dt><a class="internal" href="/en-US/docs/The_Mozilla_platform" title="en-US/docs/The Mozilla platform">The Mozilla platform</a></dt> + <dd>Information about the workings of the Mozilla platform.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Adding_APIs_to_the_navigator_object" title="en-US/docs/Developer_Guide/Adding_APIs_to_the_navigator_object">Adding APIs to the navigator object</a> {{ gecko_minversion_inline("9.0") }}</dt> + <dd>How to augment the {{ domxref("window.navigator") }} object with additional APIs.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Interface_Compatibility" title="en-US/docs/Developer Guide/Interface Compatibility">Interface Compatibility</a></dt> + <dd>Guidelines for modifying scriptable and binary APIs in Mozilla.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Customizing_Firefox" title="en-US/docs/Developer Guide/Customizing Firefox">Customizing Firefox</a></dt> + <dd>Information about creating customized versions of Firefox.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Virtual_ARM_Linux_environment" title="Virtual ARM Linux environment">Virtual ARM Linux environment</a></dt> + <dd>How to set up an ARM emulator running Linux for testing ARM-specific, but not necessarily platform-specific, code. Useful for mobile developers.</dd> + </dl> + </td> + <td> + <h2 class="Tools" id="Tools">Tools</h2> + + <dl> + <dt><a class="link-https" href="https://bugzilla.mozilla.org/" title="https://bugzilla.mozilla.org/">Bugzilla</a></dt> + <dd>The <a class="internal" href="/en-US/docs/Bugzilla" title="en-US/docs/Bugzilla">Bugzilla</a> database used to track issues for Mozilla projects.</dd> + <dt><a class="external" href="http://mxr.mozilla.org/" title="http://mxr.mozilla.org/">MXR</a></dt> + <dd>Browse and search the Mozilla source code repository on the Web.</dd> + <dt><a class="external" href="http://bonsai.mozilla.org/cvsqueryform.cgi" title="http://bonsai.mozilla.org/cvsqueryform.cgi">Bonsai</a></dt> + <dd>The <a class="internal" href="/en-US/docs/Bonsai" title="en-US/docs/Bonsai">Bonsai</a> tool lets you find out who changed what file in the repository, and when they did it.</dd> + <dt><a class="internal" href="/en-US/docs/Mercurial" title="en-US/docs/Mercurial">Mercurial</a></dt> + <dd>The distributed version-control system used to manage Mozilla's source code.</dd> + <dt><a class="external" href="http://tinderbox.mozilla.org/showbuilds.cgi" title="http://tinderbox.mozilla.org/showbuilds.cgi">Tinderbox</a></dt> + <dd><a class="internal" href="/en-US/docs/Tinderbox" title="en-US/docs/Tinderbox">Tinderbox</a> shows the status of the tree (whether or not it currently builds successfully). Check this before checking in and out, to be sure you're working with a working tree.</dd> + <dt><a class="internal" href="/en-US/docs/Crash_reporting" title="en-US/docs/Crash reporting">Crash tracking</a></dt> + <dd>Information about the <a class="link-https" href="https://crash-reports.mozilla.com/reports" title="https://crash-reports.mozilla.com/reports">Socorro</a> and <a class="external" href="http://talkback-public.mozilla.org/search/start.jsp" title="http://talkback-public.mozilla.org/search/start.jsp">Talkback</a> crash reporting systems.</dd> + <dt><a class="external" href="http://graphs.mozilla.org/" title="http://graphs.mozilla.org/">Performance tracking</a></dt> + <dd>See performance information for Mozilla projects.</dd> + <dt><a href="/en-US/docs/Developer_Guide/Callgraph" title="en-US/docs/Developing Mozilla/Callgraph">Callgraph</a></dt> + <dd>A tool to help perform static analysis of the Mozilla code by generating callgraphs automatically.</dd> + <dt><a class="external" href="http://www.mozilla.org/community/developer-forums.html" title="http://www.mozilla.org/community/developer-forums.html">Developer forums</a></dt> + <dd>A topic-specific list of discussion forums where you can talk about Mozilla development issues.</dd> + <dt><a class="external" href="http://www.brianbondy.com/mozilla/cheatsheet/" title="http://www.brianbondy.com/mozilla/cheatsheet/">Mozilla Platform Development Cheat Sheet</a></dt> + <dd>Brian Bondy's list of frequently referenced information for platform developers.</dd> + </dl> + </td> + </tr> + </tbody> +</table> + +<p> </p> diff --git a/files/zh-tw/mozilla/developer_guide/source_code/cvs/index.html b/files/zh-tw/mozilla/developer_guide/source_code/cvs/index.html new file mode 100644 index 0000000000..385662f39f --- /dev/null +++ b/files/zh-tw/mozilla/developer_guide/source_code/cvs/index.html @@ -0,0 +1,182 @@ +--- +title: 使用CVS獲取Mozilla源代碼 +slug: Mozilla/Developer_guide/Source_Code/CVS +translation_of: Mozilla/Developer_guide/Source_Code/CVS +--- +<div class="note">Tips: This document descibes how to get source code for older versions of the code, Gecko 1.9.0, Firefox 3 or earlier, and older versions of NSS and NSPR. Development for Gecko 1.9.1/Firefox 3.5 and beyond, and recent versions of NSS and NSPR, uses the <a class="internal" href="/en-US/docs/Developer_Guide/Source_Code/Mercurial" title="En/Developer Guide/Source Code/Mercurial">Mercurial</a> source code control system.</div> + +<div class="warning"> +<p>到 七月 2015, 在Mozilla 上CVS 服務不會有長時間的操作.為訪問CVS 存檔, 請看 <a href="https://blog.mozilla.org/it/2015/07/28/vcs-decom-status/">the blog post</a> 宣告改變.</p> +</div> + +<p><span class="outputBox-2liU7_0">那些正在進行積極開發的人可以使用 CVS 查看最新的源代碼。如果您計劃提供補丁並修復錯誤,這是最好的方法,因為它可以讓您獲得最新的更新並將它們與您自己的更改合併。</span></p> + +<p><span class="outputBox-2liU7_0">如果要編譯產品以供發布,通常下載 Mozilla 源代碼 tarball</span></p> + +<h3 id="Getting_Started" name="Getting_Started">開始</h3> + +<p><span class="outputBox-2liU7_0">CVS 表示 “並發版本控制系統”。要了解有關 CVS 的更多信息,請訪問</span></p> + +<p><a href="https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/unifiedrepo.html">支持文檔</a></p> + +<p>所有人可以檢查 (也被認爲是 "拉" 或是 "下載") 通過 CVS, 但只有一個確定的人擁有能力記錄 (創建改變, 也被認爲是 "提交"). 那些人是模塊所有人以及他們的代表. 閲讀我們的檔案在 <a class="external" href="https://www.mozilla.org/hacking/">hacking mozilla</a> 去找到怎樣獲得能力記錄. 你也許也想閲讀關於 <a href="https://developer.mozilla.org/en/Using_SSH_to_connect_to_CVS">通過SSH連接CVS</a>.</p> + +<h4 id="Requirements" name="Requirements">必選</h4> + +<p>檢查原始碼需要運行 <a class="external" href="http://www.nongnu.org/cvs/">CVS</a> 1.11 及其更新版本. CVS伺服器不適用于1.12.13 以及懸挂的替代結果, 雖然 1.12.9 知道如何工作. 而且, 你必須利用 <a class="external" href="https://www.gnu.org/software/make/">GNU make</a> 檢查以及構建 Mozilla. 沒有其他的 “make” 程式是可接受的. 在 Windows, mac 以及合格的 GNU 系統 (比如 GNU/Linux), 使用 "make" 運行 GNU make; 在許多的 非 GNU unixes (比如 Solaris, etc.), 使用 "gmake".</p> + +<h3 id="CVS_Client_Settings" name="CVS_Client_Settings">CVS 用戶端設置</h3> + +<p>"cvsroot" (倉庫驗証字符串) 用於匿名訪問 Mozilla CVS 是</p> + +<pre class="eval"><a class="link-mailto" href="mailto::pserver:anonymous@cvs-mirror.mozilla.org" rel="freelink">:pserver:anonymous@cvs-mirror.mozilla.org</a>:/cvsroot +</pre> + +<p>如果你使用圖形化 CVS 用戶界面, 使用後面的服務器數據:</p> + +<ul> + <li><strong>host</strong>: "cvs-mirror.mozilla.org"</li> + <li><strong>repository path</strong>: "/cvsroot"</li> + <li><strong>user</strong>: "anonymous"</li> + <li><strong>connection type</strong>: pserver</li> + <li><strong>port</strong>: default (2401)</li> +</ul> + +<h3 id="Selecting_a_Project_to_Pull" name="Selecting_a_Project_to_Pull">選擇一個項目 Pull</h3> + +<p>由於幾個不同的應用程式是從一個相同的基礎源代碼構建而成, 你必須選擇哪一個程式在命令行上使用 <code>MOZ_CO_PROJECT</code> 變量來檢查. 當他將要檢查實際源代碼時, 信息需要支持。 (見適當的<a href="#Checkout">checkout</a> <a href="#Checkout_2">section</a> 之下, 你應該根據分支進行檢查). 可能性選項包括以下内容:</p> + +<p> 检查以上所有项目的源代码,以及一些附加的实用程序代码</p> + +<dl> + <dt>browser </dt> + <dd>獨立的 ”Firefox" 瀏覽器</dd> + <dt>mail </dt> + <dd>獨立的 “Thunderbird” 郵件/新聞 客戶端</dd> + <dt>suite </dt> + <dd>傳統的 ”Mozilla“ SeaMonkey 瀏覽器套裝, 郵件/新聞, composer, 與其他應用程式.</dd> + <dt>minimo </dt> + <dd>獨立的小設備瀏覽器.</dd> + <dt>composer </dt> + <dd>獨立的 HTML composer.</dd> + <dt>calendar </dt> + <dd>獨立的 "Sunbird" 日曆 應用.</dd> + <dt>xulrunner </dt> + <dd>下一代 XUL 應用啓動器.</dd> + <dt>camino </dt> + <dd>“Camino” Macintosh 本地瀏覽器</dd> + <dt>all </dt> +</dl> + +<p>Multiple projects can be specified with commas: <code>MOZ_CO_PROJECT=suite,browser,xulrunner</code>.</p> + +<p><strong>Note</strong> that if you are using a custom <code><a href="/en/Configuring_Build_Options#Using_a_.mozconfig_Configuration_File" title="en/Configuring_Build_Options#Using_a_.mozconfig_Configuration_File">.mozconfig</a></code> file, you can also specify <code>MOZ_CO_PROJECT</code> there, instead of including it on the command line.</p> + +<h3 id="Checking_Out_a_New_Source_Tree" name="Checking_Out_a_New_Source_Tree">Checking Out a New Source Tree</h3> + +<h4 id="Check_Tinderbox" name="Check_Tinderbox">Check Tinderbox</h4> + +<p>Before pulling a tree, you should always check the appropriate <a href="/en/Tinderbox" title="en/Tinderbox">Tinderbox</a> to make sure that the codebase is not broken. If there are red tinderboxes, it is usually advisable to wait until they are green before pulling a tree.</p> + +<h4 id="Branch_HEAD" name="Branch_HEAD">Branch HEAD</h4> + +<p>To check out a new source tree from scratch, get the <code>client.mk</code> file which contains makefile instructions which are used to pull the rest of the tree:</p> + +<pre class="eval">$ cvs -d <a class="link-mailto" href="mailto::pserver:anonymous@cvs-mirror.mozilla.org" rel="freelink">:pserver:anonymous@cvs-mirror.mozilla.org</a>:/cvsroot co mozilla/client.mk +</pre> + +<p>Note: if you have already set up a <code><a href="/en/Configuring_Build_Options#Using_a_.mozconfig_Configuration_File" title="en/Configuring_Build_Options#Using_a_.mozconfig_Configuration_File">.mozconfig</a></code> file, you may also need to check out the following files:</p> + +<dl> + <dt>Firefox </dt> + <dd> + <pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/browser/config/mozconfig</pre> + </dd> + <dt>Thunderbird </dt> + <dd> + <pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/mail/config/mozconfig</pre> + </dd> +</dl> + +<p>{{ Note("The last version of Thunderbird on the HEAD was a post-3.0a2 nightly build. The last version of SeaMonkey on the HEAD was a 2.0a1pre nightly build. No further development of Thunderbird or SeaMonkey is taking place on the HEAD of CVS") }}</p> + +<h4 id="Specific_Branch" name="Specific_Branch">Specific Branch</h4> + +<p>If you want to check out the source code of a specific <a class="external" href="https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/dag.html#creating-dag-branches">CVS branch</a>, use</p> + +<pre class="eval">$ cvs -d <a class="link-mailto" href="mailto::pserver:anonymous@cvs-mirror.mozilla.org" rel="freelink">:pserver:anonymous@cvs-mirror.mozilla.org</a>:/cvsroot co -r BRANCH mozilla/client.mk +</pre> + +<p>instead. To, for example, pull the Firefox 2.0/Thunderbird 2.0/SeaMonkey 1.1 development branch, replace BRANCH above with MOZILLA_1_8_BRANCH. For available branch tags in Mozilla, see <a href="/en/CVS_Tags" title="en/CVS_Tags">CVS Tags</a>.</p> + +<p>The information on pulling project specific <code>.mozconfig</code> files as listed in the <a href="#Branch_HEAD">previous section</a> apply to other branches than HEAD as well of course.</p> + +<h4 id="Checkout" name="Checkout">Checkout</h4> + +<p>After having chosen the correct branch, run:</p> + +<pre class="eval">$ cd mozilla +$ make -f client.mk checkout MOZ_CO_PROJECT=<em>option,option</em> +</pre> + +<p>As mentioned above, if you are using a custom <code>.mozconfig</code> file where you have already specified the <code>MOZ_CO_PROJECT</code> variable, you do not need to repeat it here on command line.</p> + +<div class="note">Always use <code>client.mk</code> to checkout the Mozilla sources: do not check out the <code>mozilla/</code> module directly. Various subprojects such as NSS, NSPR, and LDAP C SDK are pulled from stable release tags, even when regular mozilla development occurs on the trunk.</div> + +<h4 id="Specific_Time" name="Specific_Time">Specific Time</h4> + +<p>If you want to check out the source code as it was at a specific time you can use the MOZ_CO_DATE variable. For example <code>MOZ_CO_DATE="20 Oct 2006 17:00 PDT"</code>.</p> + +<p>This can either be added to your <code><a href="/en/Configuring_Build_Options#Using_a_.mozconfig_Configuration_File" title="en/Configuring_Build_Options#Using_a_.mozconfig_Configuration_File">.mozconfig</a></code> file, or specified on the command line, such as</p> + +<pre class="eval">$ cd mozilla +$ make -f client.mk checkout MOZ_CO_DATE="20 Oct 2006 17:00 PDT" MOZ_CO_PROJECT=<em>option,option</em> +</pre> + +<h3 id="Changing_the_Source_Tree_to_a_Different_Branch" name="Changing_the_Source_Tree_to_a_Different_Branch">Changing the Source Tree to a Different Branch</h3> + +<h4 id="Branch_HEAD_2" name="Branch_HEAD_2">Branch HEAD</h4> + +<p>In order to update a source tree (be it branch HEAD or a specific branch) to latest branch HEAD, first run:</p> + +<pre class="eval">$ cd mozilla +$ cvs up -A client.mk +</pre> + +<p>The -A option removes any "sticky branch" information, which leads to the effect that the tree is updated to HEAD.</p> + +<h4 id="Specific_Branch_2" name="Specific_Branch_2">Specific Branch</h4> + +<p>To update a source tree which was pulled from a specific branch, start with</p> + +<pre class="eval">$ cd mozilla +$ cvs up -r BRANCH client.mk +</pre> + +<p>instead. Replace BRANCH by the tag of the branch you want to update.</p> + +<h3 id="Updating_a_Source_Tree" name="Updating_a_Source_Tree">Updating a Source Tree</h3> + +<p>To update your source tree simply do the following:</p> + +<pre class="eval">$ make -f client.mk checkout MOZ_CO_PROJECT=<em>option,option</em> +</pre> + +<p>As always, if you use a custom <code>.mozconfig</code> file where <code>MOZ_CO_PROJECT</code> is already defined, you do not need to repeat it on command line.</p> + +<h3 id="Creating_a_Diff_File" name="Creating_a_Diff_File">Creating a Diff File</h3> + +<p>In order to create a diff of a single local file against the current file in the repository, use:</p> + +<pre class="eval">$ cvs diff -u8p FILENAME +</pre> + +<p>See <a href="/en/Creating_a_patch" title="en/Creating_a_patch">Creating a patch</a> for more information.</p> + +<h3 id="Converting_a_Downloaded_Source_Tree" name="Converting_a_Downloaded_Source_Tree">Converting a Downloaded Source Tree</h3> + +<p>Downloaded source trees from mozilla.org (<a href="/En/Developer_Guide/Source_Code/Downloading_Source_Archives" title="en/Mozilla_Source_Code_(HTTP//FTP)">source tarballs</a>) are already set up with CVS information, like a normal checkout. You can update these trees like normal trees to the latest code, without special action. See previous section on how to update a source tree.</p> + +<p><span class="comment">interwiki link</span></p> + +<p> </p> diff --git a/files/zh-tw/mozilla/developer_guide/source_code/index.html b/files/zh-tw/mozilla/developer_guide/source_code/index.html new file mode 100644 index 0000000000..6bfc3bcd9a --- /dev/null +++ b/files/zh-tw/mozilla/developer_guide/source_code/index.html @@ -0,0 +1,44 @@ +--- +title: 與 Mozilla 原始碼共事 +slug: Mozilla/Developer_guide/Source_Code +translation_of: Mozilla/Developer_guide/Source_Code +--- +<p>以下文章將幫你掌握 Mozilla 原始碼、了解怎麼閱讀程式碼、並把建議的變更放到代碼樹裡面。</p> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a class="internal" href="/En/Developer_Guide/Source_Code/Mercurial" title="En/Mozilla Source Code (Mercurial)">Getting the code from the Mercurial repository</a></dt> + <dd>If you plan to contribute to the Mozilla project, the best way to get the code is to check it out from the version control repository. Learn how to do that here.</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Using_the_VM">Getting a pre-configured Mozilla build system virtual machine</a></dt> + <dd>This is the easiest way to get started: use a VirtualBox virtual machine which is already configured with a complete build environment for you to use. Just boot the VM and build!</dd> + <dt><a class="internal" href="/En/Developer_Guide/Source_Code/Downloading_Source_Archives" title="En/Mozilla Source Code (HTTP//FTP)">Downloading the code using HTTP or FTP</a></dt> + <dd>If you want to fetch the code for a specific release of a particular Mozilla product, you may prefer to download a source code archive.</dd> + <dt><a class="internal" href="/en/Viewing_and_searching_Mozilla_source_code_online" title="En/Viewing and searching Mozilla source code online">Viewing and searching Mozilla source code online</a></dt> + <dd>Learn how to use MXR, Mozilla's online search and browsing tool for accessing the source code. This isn't a good way to download the code, but is a great way to search it.</dd> + <dt><a class="internal" href="/en/Mozilla_Source_Code_Directory_Structure" title="en/Mozilla Source Code Directory Structure">Navigating the Mozilla source code</a></dt> + <dd>Learn about the various folders in the Mozilla source tree, and how to find what you're looking for.</dd> + <dt><a class="external" href="/en/Introduction#Find_a_bug_we%27ve_identified_as_a_good_fit_for_new_contributors." title="/en/Introduction#Find_a_bug_we%27ve_identified_as_a_good_fit__for_new_contributors.">Bugs for newcomers</a></dt> + <dd>If you are new to the project and want something to work on, look here.</dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a class="internal" href="/En/Developer_Guide/Coding_Style" title="En/Mozilla Coding Style Guide">Mozilla Coding Style Guide</a></dt> + <dd>The code style guide provides information about how you should format your source code to ensure that you don't get mocked by the reviewers.</dd> + <dt><a href="/En/Developer_Guide/Interface_development_guide" title="En/Developer Guide/Interface development guide">Interface development guide</a></dt> + <dd>Guidelines and documentation for how to create and update XPCOM interfaces.</dd> + <dt><a href="/en-US/docs/Mozilla/Developer_guide/SVG_Guidelines">SVG Cleanup Guide</a></dt> + <dd>Guidelines and best practices for shipping new SVGs.</dd> + <dt><a class="link-https" href="https://wiki.mozilla.org/Build:TryServer" title="https://wiki.mozilla.org/Build:TryServer">Try Servers</a></dt> + <dd>Mozilla products build on at least three platforms. If you don't have access to them all, you can use the try servers to test your patches and make sure the tests pass.</dd> + <dt><a class="internal" href="/en/Creating_a_patch" title="En/Creating a patch">Creating a patch</a></dt> + <dd>Once you've made a change to the Mozilla code, the next step (after making sure it works) is to create a patch and submit it for review. <em>This article needs to be updated fully for Mercurial.</em></dd> + <dt><a class="external" href="http://www.mozilla.org/hacking/committer/" title="http://www.mozilla.org/hacking/committer/">Getting commit access to the source code</a></dt> + <dd>Feel ready to join the few, the proud, the committers? Find out how to get check-in access to the Mozilla code.</dd> + <dt><a class="internal" href="/En/Developer_Guide/Source_Code/CVS" title="En/Mozilla Source Code (CVS)">Getting older Mozilla code from CVS</a></dt> + <dd>Older versions of the Mozilla source code, as well as the current versions of NSS and NSPR, are kept in a CVS repository. Learn about that in this article.</dd> +</dl> +</div> +</div> diff --git a/files/zh-tw/mozilla/firefox/developer_edition/index.html b/files/zh-tw/mozilla/firefox/developer_edition/index.html new file mode 100644 index 0000000000..d912a36470 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/developer_edition/index.html @@ -0,0 +1,56 @@ +--- +title: Firefox 開發者版本 +slug: Mozilla/Firefox/Developer_Edition +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox/Developer_Edition +--- +<div>{{FirefoxSidebar}}</div><p style="text-align: center;"><img alt="" src="https://mdn.mozillademos.org/files/9143/firefox-dev-ed_logo-only_1024.png" style="width: 256px; height: 256px; display: block; margin-left: auto; margin-right: auto;">一個專為 Web 開發者量身定做的 Firefox 版本。</p> + +<p><a href=" https://www.mozilla.org/zh-TW/firefox/developer/" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">下載 Firefox 開發者版本</a></p> + +<hr> +<div class="column-container"> +<div class="column-half"> +<h3 id="最新的_Firefox_功能"><strong>最新的 Firefox 功能</strong></h3> + +<p>Firefox Developer Edition 取代了 <a href="https://wiki.mozilla.org/Release_Management/Release_Process">Firefox 釋出流程</a>中的 Aurora 頻道。如同 Aurora,各功能會在 Nightly builds 中穩定下來後,每隔六週下放到 Developer Edition 裡面。</p> + +<p>透過 Developer Edition,您可以在至少 12 週前接觸到 Firefox 正式釋出的工具及平台功能。</p> + +<p><a href="/zh-TW/Firefox/Releases/35">來看看 Developer Edition 有哪些新功能</a>。</p> +</div> + +<div class="column-half"> +<h3 id="清晰的界面"><strong>清晰的界面</strong></h3> + +<p>更快找到開發者工具。</p> + +<h3 id="實驗性的開發者工具"><strong>實驗性的開發者工具</strong></h3> + +<p>我們加入了尚未準備好正式釋出的實驗性工具。</p> + +<p>例如,Developer Edition 加入了 <a href="/en-US/docs/Tools/Valence">Valence 附加元件</a>,一個可以讓您透過 <a href="/zh-TW/docs/Tools">Firefox 開發者工具</a>連到其他瀏覽器,像是 Android 上面的 Chrome 及 iOS 上面的 Safari。</p> +</div> +</div> + +<div class="column-container"> +<div class="column-half"> +<h3 id="獨立的設定檔"><strong>獨立的設定檔</strong></h3> + +<p>Firefox Developer Edition 使用一個獨立於其他已經安裝在您電腦上 Firefox 版本的設定檔。這意味著您可以簡單的在執行 Developer Edition 的同時使用正式或測試版的 Firefox。</p> + +<div class="note"> +<p><strong>註:</strong>這表示在您第一次啟動 Developer Edition 後,將會看到一個完全沒有自訂外觀﹑沒有擴充套件、沒有書籤、也沒有歷史紀錄的瀏覽器。若您想讓您的 Developer Edition 跟您其他版本的 Firefox 使用一樣的設定,您可以<a href="https://support.mozilla.org/zh-TW/kb/how-do-i-set-up-firefox-sync">使用 Firefox Sync</a> 來達成同步。</p> +</div> +</div> + +<div class="column-half"> +<h3 id="針對_Web_開發者的設置"><strong>針對 Web 開發者的設置</strong></h3> + +<p>我們針對 Web 開發者的需求調整了預設的設定值。例如,chrome 及遠端除錯功能預設為開啟。</p> +</div> +</div> + +<p> </p> diff --git a/files/zh-tw/mozilla/firefox/developer_edition/reverting/index.html b/files/zh-tw/mozilla/firefox/developer_edition/reverting/index.html new file mode 100644 index 0000000000..0a83335196 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/developer_edition/reverting/index.html @@ -0,0 +1,25 @@ +--- +title: 回到過去 +slug: Mozilla/Firefox/Developer_Edition/Reverting +translation_of: Mozilla/Firefox/Developer_Edition/Reverting +--- +<div>{{FirefoxSidebar}}</div><h2 id="換掉_Developer_Edition_佈景主題">換掉 Developer Edition 佈景主題</h2> + +<p><br> + 如果您想繼續使用 Developer Edition, 可是比較喜歡目前套用在 Firefox 及 Firefox Beta 的 Australis 界面,您可以切換到一般的 Firefox 佈景主題:只要打開「自訂模式」面板並點擊「使用 Firefox Developer Edition 佈景主題」按鈕即可。</p> + +<p>{{EmbedYouTube("OvJwofTjsNg")}}</p> + +<p>注意,目前 Developer Edition 佈景主題尚未與個性面板相容。所以如果您想套用個性面板,您必須先切回 Australis 界面。</p> + +<h2 id="回到_Firefox_Aurora">回到 Firefox Aurora</h2> + +<p><br> + 如果您想保留所有 Firefox Developer Edition 的前期測試功能,但是又不想要有其他的改變,您可以回復到看起來就像是以前的 Firefox Aurora。請依序執行下面兩步驟:</p> + +<ol> + <li>開啟 Developer Edition 的選項頁面,並將「允許 Firefox Developer Edition 與 Firefox 同時執行」選項的勾選取消掉。您將會收到重新啟動瀏覽器的提示。</li> + <li>瀏覽器重新啟動後,您可以打開「自訂模式」面板並點擊「使用 Firefox Developer Edition 佈景主題」按鈕來關閉 Developer Edition 佈景主題。</li> +</ol> + +<p>{{EmbedYouTube("0Ofq-vlw8Qw")}}</p> diff --git a/files/zh-tw/mozilla/firefox/index.html b/files/zh-tw/mozilla/firefox/index.html new file mode 100644 index 0000000000..55827cdf75 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/index.html @@ -0,0 +1,62 @@ +--- +title: Firefox +slug: Mozilla/Firefox +tags: + - Firefox + - Mozilla + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox +--- +<div>{{FirefoxSidebar}}</div> + +<p><a class="external external-icon" href="https://www.mozilla.org/firefox/">Firefox</a> 是 Mozilla 基金會最受歡迎的網頁瀏覽程式,在眾多平台包含 Windows、Mac OS X、桌面版 Linux 及 Android 行動裝置上發行。 具有廣大相容性,整合最新的 Web 技術和強大的<a href="/zh-TW/docs/Tools">開發工具</a>。不管你是一般使用者還是開發者,Firefox 都是您的最佳選擇。</p> + +<p>Firefox 是一項開源專案;大多數的程式碼都是由我們廣大的社群志工們所貢獻。在這裡您將會學會如何為 Firefox 專案做出貢獻,並找到一些關於打造 Firefox 擴充套件、在 Firefox 底下使用開發者工具,以及其他任務的資訊鍊結。</p> + +<div class="summary"> +<p>學習如何打造 <a class="external external-icon" href="https://www.mozilla.org/firefox/">Firefox</a> 的擴充套件、如何自己開發及編譯 Firefox,以及 Firefox 的內部及子項目是如何運作的。</p> +</div> + +<ul class="card-grid"> + <li><span>開發者技術文件</span> + + <p><a href="/zh-TW/Firefox/Releases">以開發者為主的技術文件</a>;知道各個 Firefox 版本針對網站及擴充套件新增了哪些功能。</p> + </li> + <li><span>專案文件</span> + <p>獲得關於<a href="/zh-TW/docs/Mozilla"> Firefox內部</a> 及它的系統版本號更詳細的資訊,以便你可以找到一個方式來處理你的程式碼。</p> + </li> + <li><span>開發者指南</span> + <p>我們的 <a href="/zh-TW/docs/Developer_Guide">開發者教學</a> 提供了一些資訊來解說如何獲得及編譯 Firefox 原始碼,如何處理你的程式碼,以及如何替專案奉獻心力。</p> + </li> +</ul> + +<h2 id="Firefox_更新頻道">Firefox 更新頻道</h2> + +<p>Firefox 釋出被分成四個 <strong>更新頻道</strong>:</p> + +<h3 id="Firefox_每日更新頻道">Firefox 每日更新頻道</h3> + +<p>每個晚上我們會建置 Firefox 在 <a href="/zh-TW/docs/mozilla-central">mozilla-central</a> 中最新的程式碼。這些版本是為了開發者,或是那些想測試還在研發中的尖端科技的嘗鮮者而建置的。</p> + +<p><a class="external external-icon" href="https://nightly.mozilla.org/" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">下載 Firefox 每日版</a></p> + +<h3 id="Firefox_開發者版本">Firefox 開發者版本</h3> + +<p>這個 Firefox 是為了開發者量身訂製的版本。每六個禮拜,我們會將 Firefox 每日版中已經夠穩定的功能加入,並釋出新版本的 Firefox 開發者版本。 我們也會將一些為了開發者設計的額外功能加入其中,而那些功能只會在這個頻道出現</p> + +<p><a href="/zh-TW/Firefox/Developer_Edition">了解更多關於 Firefox 開發者版本的資訊</a></p> + +<p><a class="external external-icon" href="https://www.mozilla.org/firefox/developer/" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">下載 Firefox 開發者版本</a></p> + +<h3 id="Firefox_Beta_測試版">Firefox Beta 測試版</h3> + +<p>在 Firefox 開發者版本花費六個禮拜後,我們會將那些夠穩定的功能加入並釋出新版本的 Firefox Beta 版。Firefox Beta 版是為了那些 Firefox 愛好者測試那些確定會在下個版本釋出的功能。</p> + +<p><a class="external external-icon" href="https://www.mozilla.org/firefox/channel/#beta" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">下載 Firefox Beta 版</a></p> + +<h3 id="Firefox">Firefox</h3> + +<p>在確認 Firefox Beta 版穩定的另外六個禮拜,我們已經準備好將新功能以最新版本 Firefox 的姿態推出給全球的使用者。</p> + +<p><a class="external external-icon" href="https://www.mozilla.org/firefox/channel/#firefox" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">下載 Firefox</a></p> diff --git a/files/zh-tw/mozilla/firefox/multiprocess_firefox/index.html b/files/zh-tw/mozilla/firefox/multiprocess_firefox/index.html new file mode 100644 index 0000000000..6afe2dd67d --- /dev/null +++ b/files/zh-tw/mozilla/firefox/multiprocess_firefox/index.html @@ -0,0 +1,80 @@ +--- +title: 多處理程序的 Firefox +slug: Mozilla/Firefox/Multiprocess_Firefox +tags: + - Elecrolysis + - Firefox + - Multiprocess + - e10s +translation_of: Mozilla/Firefox/Multiprocess_Firefox +--- +<div>{{FirefoxSidebar}}</div><p>在舊的 Firefox 桌面版本中,整個瀏覽器都是執行在單一的作業系統處理程序裡。特別是用來執行瀏覽器使用者介面(又稱為「chrome code」)的 JavaScript 和網頁裡的程式碼(又稱為「內容」或「網頁內容」)都在同一個處理程序中。<br> +<br> +最新版的 Firefox 會分別在單獨的處理程序中執行瀏覽器的介面和網頁內容。在這個架構的第一個版本中,所有瀏覽器分頁在同一個處理程序中執行,而瀏覽器介面則在另外的一個處理程序中。在未來幾個版本後,我們希望能有不只一個處理程序。這個提供多處理程序 Firefox 的專案稱為 Electrolysis,有時候會縮寫成 e10s。</p> + +<p>多處理程序的 Firefox 不會影響一般的網頁。只有 Firefox 本身和附加元件的開發者們需要直接存取網頁內容時才會受到影響。</p> + +<p>使用者介面的 chrome JavaScript 必須使用 <a href="/Firefox/Multiprocess_Firefox/Message_manager">message manager</a> 來間接存取網頁內容。為了緩解過渡期的影響,我們已經實作了 <a href="/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">Cross Process Object Wrappers</a> 和一些<a href="/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts#Compatibility_shims">給附加元件開發者的相容替代方案</a>。如果你是附加元件的開發者,想知道這會不會影響到你,請參閱<a href="/Mozilla/Add-ons/Working_with_multiprocess_Firefox">多處理程序 Firefox 的工作指南</a>。</p> + +<hr> +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/Firefox/Multiprocess_Firefox/Technical_overview">技術總覽</a></dt> + <dd>非常高階的多處理程序 Firefox 實作解釋。</dd> + <dt><a href="/zh-TW/Firefox/Multiprocess_Firefox/Web_content_compatibility">網頁內容相容性指南</a></dt> + <dd>過渡期可能出現的潛在網站相容性問題的指南和細節。提示:不是很多!</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Glossary">用語表</a></dt> + <dd>多處理程序 Firefox 的術語參考。</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Message_Manager">Message manager</a></dt> + <dd>溝通介面與內容的元件完整指南。</dd> + <dt><a href="/zh-TW/Mozilla/Add-ons/SDK/Guides/Multiprocess_Firefox_and_the_SDK">基於 SDK 的附加元件</a></dt> + <dd>如何移植使用 Add-on SDK 開發的附加元件。</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Which_URIs_load_where">各種 URIs 在哪裡載入</a></dt> + <dd>URIs(chrome:, about:, file:, resource:)在哪個處理程序中載入的快速指南。</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/Firefox/Multiprocess_Firefox/Motivation">動機</a></dt> + <dd>為什麼我們要實作多處理程序的 Firefox:效能、安全和穩定。</dd> + <dt><a href="/Mozilla/Add-ons/Working_with_multiprocess_Firefox">附加元件移植指南</a></dt> + <dd>如果你是附加元件的開發者,來這裡看看你要如何處理程式碼。</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">跨處理程序元件包裝(Cross Process Object Wrappers)</a></dt> + <dd>Cross Process Object Wrappers 是一個移植工具,讓 chrome code 可以同步存取內容。</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Debugging_frame_scripts">內容處理程序的除錯</a></dt> + <dd>如何在內容處理程序、包含框架和處理程序腳本中進行除錯。</dd> + <dt><a href="/docs/Mozilla/Firefox/Multiprocess_Firefox/Tab_selection_in_multiprocess_Firefox">多處理程序 Firefox 的分頁處理</a></dt> + <dd>在多處理程序的 Firefox 中分頁是如何切換的。</dd> +</dl> +</div> +</div> + +<hr> +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts">Chrome 程式碼的限制</a></dt> + <dd>不再有用的 Chrome 程式碼,以及如何修正。</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/Firefox/Multiprocess_Firefox/Limitations_of_frame_scripts">框架程式碼的限制</a></dt> + <dd>不再有用的框架程式碼,以及如何替代。</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="聯絡我們">聯絡我們</h2> + +<p>了解更多關於項目、參與、或者來問問題。</p> + +<ul> + <li><strong>Electrolysis 專案頁面</strong>:<a href="https://wiki.mozilla.org/Electrolysis">https://wiki.mozilla.org/Electrolysis</a></li> + <li><strong>IRC</strong>:#e10s on <a href="https://wiki.mozilla.org/IRC">irc.mozilla.org</a></li> + <li><strong>郵件群組</strong>:<a href="https://groups.google.com/forum/#!forum/mozilla.dev.tech.electrolysis">dev.tech.electrolysis</a></li> +</ul> diff --git a/files/zh-tw/mozilla/firefox/privacy/index.html b/files/zh-tw/mozilla/firefox/privacy/index.html new file mode 100644 index 0000000000..1f42ab5be0 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/privacy/index.html @@ -0,0 +1,9 @@ +--- +title: 隱私 +slug: Mozilla/Firefox/Privacy +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox/Privacy +--- +<div>{{FirefoxSidebar}}</div><p>{{ ListSubpages () }}</p> diff --git a/files/zh-tw/mozilla/firefox/privacy/tracking_protection/index.html b/files/zh-tw/mozilla/firefox/privacy/tracking_protection/index.html new file mode 100644 index 0000000000..a52f8b815d --- /dev/null +++ b/files/zh-tw/mozilla/firefox/privacy/tracking_protection/index.html @@ -0,0 +1,74 @@ +--- +title: 追蹤保護 +slug: Mozilla/Firefox/Privacy/Tracking_Protection +translation_of: Mozilla/Firefox/Privacy/Tracking_Protection +--- +<div>{{FirefoxSidebar}}</div><h2 id="追蹤保護是什麼?">追蹤保護是什麼?</h2> + +<p>在第 42 版後,Firefox Desktop 與 Firefox for Android 導入了追蹤保護。在隱私視窗(Firefox for Android 則是隱私標籤)內,Firefox 會封鎖從其他用戶追蹤網站載入的內容。</p> + +<p>有些被封鎖的內容,屬於頁面排版的一部分。如果 Firefox 因為封鎖了這些內容而造成跑版,用戶很可能會注意到。但如果針對遭封鎖的元素,以其他元素填充的話,用戶也可能完全不會注意到。</p> + +<p>當 Firefox 封鎖內容的時候,網頁主控台的訊息會跳出如下面般的紀錄:</p> + +<pre>因為啟用了追蹤保護,位於「http://some/url」的資源已被封鎖。</pre> + +<p>請記得在使用 Firefox for Android 的時候,你可以透過遠端除錯訪問主控台。</p> + +<p>Firefox UI 會在封鎖內容的時候告訴用戶,並同時告知用戶可以在此次瀏覽階段解除封鎖。用戶也可以選擇完全停用追蹤保護。</p> + +<h2 id="Firefox_如何決定封鎖什麼?">Firefox 如何決定封鎖什麼?</h2> + +<p>載入內容的封鎖與否,取決於該內容來自哪個網域。</p> + +<p>Firefox 會傳送一個確定參與用戶追蹤的網域列表。當追蹤保護啟動的時候,Firefox 會封鎖來自列表網站的內容。</p> + +<p>追蹤用戶的網站通常來自第三方廣告網站與分析網站。</p> + +<h2 id="這對我的網站有什麼意義?">這對我的網站有什麼意義?</h2> + +<p>當追蹤保護啟用時,最明顯的意義是:</p> + +<ul> + <li>用戶不會見到由第三方維護的追蹤性內容</li> + <li>你的網站無法使用與追蹤有關的第三方廣告與分析服務。</li> +</ul> + +<p>更值得注意的是,如果你的網站有部分依賴於追蹤器的運作程式碼,那這些追蹤程式碼將會被封鎖和禁止並可能導致你的網站失去正常運作當追蹤保護被啟用。例如,當你的網站包含程式碼,那些程式碼依賴於追蹤網站所提供的程式碼的功能,那麼這些追蹤網站的程式碼的功能將會失敗,不會運作,停止呼叫程式碼,失去網站的運作功能。</p> + +<p>像是說,不要這樣用 Google Analytics:</p> + +<pre class="brush:html example-bad"><a href="http://www.example.com" onclick="trackLink('http://www.example.com', event);">Visit example.com</a> +<script> +function trackLink(url,event) { + event.preventDefault(); + ga('send', 'event', 'outbound', 'click', url, { + 'transport': 'beacon', + 'hitCallback': function() { + document.location = url; + } + }); +} +</script></pre> + +<p>而是要在使用物件以前偵測該物件是否存在或被停用,防止程式運作的失敗。像是:</p> + +<pre class="brush:html example-good"><a href="http://www.example.com" onclick="trackLink('http://www.example.com', event);">Visit example.com</a> +<script> +function trackLink(url,event) { + event.preventDefault(); + if (window.ga && <span class="pl-smi">ga</span>.loaded) { + ga('send', 'event', 'outbound', 'click', url, { + 'transport': 'beacon', + 'hitCallback': function() { document.location = url; } + }); + } else { + document.location = url; + } +} +</script> +</pre> + +<p>關於此技術的詳細資訊可參見 <a href="https://hacks.mozilla.org/2016/01/google-analytics-privacy-and-event-tracking/">Google Analytics, Privacy, and Event Tracking</a>.</p> + +<p>取決於那些第三方網站程式的程式碼寫法和運作方式,這樣的程式碼寫法不會是適合和適用於你的網站的程式碼。所以說,你的網站將會失敗停止運作如果這些第三方外掛程式碼回應過慢或不可用或追蹤程式碼被外掛程式停用。</p> diff --git a/files/zh-tw/mozilla/firefox/releases/1.5/index.html b/files/zh-tw/mozilla/firefox/releases/1.5/index.html new file mode 100644 index 0000000000..01321916f6 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/1.5/index.html @@ -0,0 +1,103 @@ +--- +title: Firefox 1.5 技術文件 +slug: Mozilla/Firefox/Releases/1.5 +translation_of: Mozilla/Firefox/Releases/1.5 +--- +<div>{{FirefoxSidebar}}</div><p>Based on the <a href="/en-US/docs/Gecko" title="en-US/docs/Gecko">Gecko</a> 1.8 engine, Firefox 1.5 improved its already best in class standards support, and provided new capabilities to enable the next generation of web applications. Firefox 1.5 features improved support for CSS2 and CSS3, APIs for scriptable and programmable 2D graphics through <a href="/en-US/docs/SVG" title="en-US/docs/SVG">SVG</a> 1.1 and <a class="internal" href="/en-US/docs/HTML/Canvas" title="en-US/docs/HTML/Canvas"><code><canvas></code></a>, <a href="/en-US/docs/XForms" title="en-US/docs/XForms">XForms</a> and XML events, as well as many DHTML, JavaScript, and DOM enhancements.</p> +<h2 id="Developer_Tools">Developer Tools</h2> +<p>Several tools and browser extensions are available to help developers support Firefox 1.5.</p> +<ul> + <li><a href="/en-US/docs/DOM_Inspector" title="en-US/docs/DOM_Inspector">DOM Inspector</a>, a tool that allows developers to inspect and modify documents without having to edit the document directly. DOM Inspector is available as part of the Custom install option in Firefox 1.5 under Developer Tools.</li> + <li>JavaScript console, a tool to write and test JavaScript code as well as view JavaScript and CSS errors on a page.</li> + <li>View page source, with syntax highlighting and find features.</li> + <li><a class="link-https" href="https://addons.mozilla.org/extensions/showlist.php?application=firefox&category=Developer%20Tools">Browser extensions</a> including the <a class="external" href="http://www.joehewitt.com/software/firebug/">FireBug</a>, <a href="/en-US/docs/Web_Developer_Extension_(external)" title="en-US/docs/Web_Developer_Extension_(external)">Web Developer toolbar</a>, <a href="/en-US/docs/Live_HTTP_Headers_(external)" title="en-US/docs/Live_HTTP_Headers_(external)">Live HTTP Headers</a>, <a href="/en-US/docs/HTML_Validator_(external)" title="en-US/docs/HTML_Validator_(external)">HTML Validator</a> and many more.</li> +</ul> +<p><strong>Note:</strong> Some extensions do not currently support Firefox 1.5, and will be automatically disabled.</p> +<h2 id="Overview">Overview</h2> +<p>Some of the new features in Firefox 1.5:</p> +<h3 id="Web_site_and_application_developers">Web site and application developers</h3> +<dl> + <dt> + <a href="/en-US/docs/SVG_In_HTML_Introduction" title="en-US/docs/SVG_In_HTML_Introduction">SVG In XHTML Introduction</a></dt> + <dd> + Learn how to use SVG in XHTML pages and how to use JavaScript and CSS to manipulate the picture in the same way you would script regular XHTML. See also <a href="/en-US/docs/SVG_in_Firefox" title="en-US/docs/SVG_in_Firefox">SVG in Firefox</a> to learn about the status and known problems of SVG implementation in Firefox.</dd> + <dt> + <a href="/en-US/docs/HTML/Canvas/Drawing_Graphics_with_Canvas" title="en-US/docs/Drawing_Graphics_with_Canvas">Drawing Graphics with Canvas</a></dt> + <dd> + Learn about the new <code><canvas></code> tag and how to draw graphs and other objects in Firefox.</dd> + <dt> + <a href="/en-US/docs/CSS/Using_CSS_multi-column_layouts" title="en-US/docs/CSS3_Columns">CSS3 Columns</a></dt> + <dd> + Learn about the new support for automatic multi-column text layout as proposed for <a href="/en-US/docs/CSS/CSS3" title="CSS3">CSS3</a>.</dd> + <dt> + <a href="/en-US/docs/Using_Firefox_1.5_caching" title="en-US/docs/Using_Firefox_1.5_caching">Using Firefox 1.5 caching</a></dt> + <dd> + Learn about <code>bfcache</code> and how it speeds up back and forward navigation.</dd> +</dl> +<h3 id="XUL_and_Extension_Developers">XUL and Extension Developers</h3> +<dl> + <dt> + <a href="/en-US/docs/Building_an_Extension" title="en-US/docs/Building_an_Extension">Building an Extension</a></dt> + <dd> + This tutorial will take you through the steps required to build a very basic extension for Firefox. Also see <a class="external" href="http://kb.mozillazine.org/Getting_started_with_extension_development">another tutorial on MozillaZine knowledge base</a>, which demonstrates the new features of the Extension Manager in 1.5 that make creating a new extension even easier.</dd> + <dt> + <a href="/en-US/docs/XPCNativeWrapper" title="en-US/docs/XPCNativeWrapper">XPCNativeWrapper</a></dt> + <dd> + <code>XPCNativeWrapper</code> is a way to wrap up an object so that it's <a href="/en-US/docs/Safely_accessing_content_DOM_from_chrome" title="en-US/docs/Safely_accessing_content_DOM_from_chrome">safe to access from privileged code</a>. It can be used in all Firefox versions, though the behavior changed somewhat starting with Firefox 1.5 (Gecko 1.8).</dd> + <dt> + <a href="/en-US/docs/Preferences_System" title="en-US/docs/Preferences_System">Preferences System</a></dt> + <dd> + Learn about the new widgets that allow you to create Options windows easier using less JavaScript code.</dd> + <dt> + <a href="/en-US/docs/International_characters_in_XUL_JavaScript" title="en-US/docs/International_characters_in_XUL_JavaScript">International characters in XUL JavaScript</a></dt> + <dd> + XUL JavaScript files can now contain non-ASCII characters.</dd> + <dt> + <a href="/en-US/docs/Tree_Widget_Changes" title="en-US/docs/Tree_Widget_Changes">Tree API changes</a></dt> + <dd> + The interfaces for accessing XUL <code><tree></code> elements have changed.</dd> + <dt> + <a href="/en-US/docs/XUL_Changes_for_Firefox_1.5" title="en-US/docs/XUL_Changes_for_Firefox_1.5">XUL Changes for Firefox 1.5</a></dt> + <dd> + Summary of XUL changes. See also <a href="/en-US/docs/Adapting_XUL_Applications_for_Firefox_1.5" title="en-US/docs/Adapting_XUL_Applications_for_Firefox_1.5">Adapting XUL Applications for Firefox 1.5</a>.</dd> +</dl> +<h4 id="Networking-related_changes">Networking-related changes</h4> +<ul> + <li>Certificate prompts can now be overridden on a per-channel basis. This works by setting an interface requestor as an <a href="/en-US/docs/nsIChannel" title="en-US/docs/nsIChannel">nsIChannel</a>'s notificationCallbacks and giving out an interface for <a href="/en-US/docs/NsIBadCertListener" title="en-US/docs/NsIBadCertListener">nsIBadCertListener</a>.</li> + <li>nsIWebBrowserPersist's listeners can now implement <a href="/en-US/docs/XPCOM_Interface_Reference/nsIInterfaceRequestor" title="en-US/docs/nsIInterfaceRequestor">nsIInterfaceRequestor</a>::GetInterface and will get an opportunity to provide all interfaces that channels might ask for, including <a href="/en-US/docs/NsIProgressEventSink" title="en-US/docs/NsIProgressEventSink">nsIProgressEventSink</a> (not too useful, redundant with <a href="/en-US/docs/nsIWebProgressListener" title="en-US/docs/nsIWebProgressListener">nsIWebProgressListener</a>). Useful interfaces here include <a href="/en-US/docs/NsIChannelEventSink" title="en-US/docs/NsIChannelEventSink">nsIChannelEventSink</a> and <a href="/en-US/docs/NsIBadCertListener" title="en-US/docs/NsIBadCertListener">nsIBadCertListener</a>.</li> + <li>Extensions or other necko consumers, including XMLHttpRequest, can set a Cookie header explicitly, and necko will not replace it. Stored cookies will be merged with the explicitly set header, in a way that the explicit header will override the stored cookies.</li> +</ul> +<h2 id="New_End_user_Features">New End user Features</h2> +<h3 id="User_Experience">User Experience</h3> +<ul> + <li><strong>Faster browser navigation</strong> with improvements to back and forward button performance.</li> + <li><strong>Drag and drop reordering for browser tabs.</strong></li> + <li><strong>Answers.com is added to the search engine list</strong> for dictionary lookup.</li> + <li><strong>Improvements to product usability</strong> including descriptive error pages, redesigned options menu, RSS discovery, and "Safe Mode" experience.</li> + <li><strong>Better accessibility support</strong> including DHTML accessibility.</li> + <li><strong>Report a broken Web site wizard</strong> to report Web sites that are not working in Firefox.</li> + <li><strong>Better support for Mac OS X</strong> (10.2 and greater) including profile migration from Safari and Mac Internet Explorer.</li> +</ul> +<h3 id="Security_and_Privacy">Security and Privacy</h3> +<ul> + <li><strong>Automated update</strong> to streamline product upgrades. Notification of an update is more prominent, and updates to Firefox may now be half a megabyte or smaller. Updating extensions has also improved.</li> + <li><strong>Improvements to popup blocking.</strong></li> + <li><strong>Clear Private Data</strong> feature provides an easy way to quickly remove personal data through a menu item or keyboard shortcut.</li> +</ul> +<h3 id="Support_for_open_Web_standards">Support for open Web standards</h3> +<p>Firefox support for Web standards continues to lead the industry with consistent cross-platform implementations for:</p> +<ul> + <li>Hypertext Markup Language (<a href="/en-US/docs/HTML" title="en-US/docs/HTML">HTML</a>) and Extensible Hypertext Markup Language (<a href="/en-US/docs/XHTML" title="en-US/docs/XHTML">XHTML</a>): <a class="external" href="http://www.w3.org/TR/html401/">HTML 4.01</a> and <a class="external" href="http://www.w3.org/TR/xhtml1/">XHTML 1.0/1.1</a></li> + <li>Cascading Style Sheets (<a href="/en-US/docs/CSS" title="en-US/docs/CSS">CSS</a>): <a class="external" href="http://www.w3.org/TR/REC-CSS1">CSS Level 1</a>, <a class="external" href="http://www.w3.org/TR/REC-CSS2">CSS Level 2</a> and parts of <a class="external" href="http://www.w3.org/Style/CSS/current-work.html">CSS Level 3</a></li> + <li>Document Object Model (<a href="/en-US/docs/DOM" title="en-US/docs/DOM">DOM</a>): <a class="external" href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/">DOM Level 1</a>, <a class="external" href="http://www.w3.org/DOM/DOMTR#dom2">DOM Level 2</a> and parts of <a class="external" href="http://www.w3.org/DOM/DOMTR#dom3">DOM Level 3</a></li> + <li>Mathematical Markup Language: <a class="external" href="http://www.w3.org/Math/">MathML Version 2.0</a></li> + <li>Extensible Markup Language (<a href="/en-US/docs/XML" title="en-US/docs/XML">XML</a>): <a class="external" href="http://www.w3.org/TR/REC-xml">XML 1.0</a>, <a class="external" href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>, <a class="external" href="http://www.w3.org/TR/xml-stylesheet/">Associating Style Sheets with XML Documents 1.0</a>, <a class="external" href="http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm">Fragment Identifier for XML</a></li> + <li>XSL Transformations (<a href="/en-US/docs/XSLT" title="en-US/docs/XSLT">XSLT</a>): <a class="external" href="http://www.w3.org/TR/xslt">XSLT 1.0</a></li> + <li>XML Path Language (<a href="/en-US/docs/XPath" title="en-US/docs/XPath">XPath</a>): <a class="external" href="http://www.w3.org/TR/xpath">XPath 1.0</a></li> + <li>Resource Description Framework (<a href="/en-US/docs/RDF" title="en-US/docs/RDF">RDF</a>): <a class="external" href="http://www.w3.org/RDF/">RDF</a></li> + <li>Simple Object Access Protocol (SOAP): <a class="external" href="http://www.w3.org/TR/SOAP/">SOAP 1.1</a></li> + <li><a href="/en-US/docs/JavaScript" title="en-US/docs/JavaScript">JavaScript</a> 1.6, based on <a href="/en-US/docs/ECMAScript" title="en-US/docs/ECMAScript">ECMA-262</a>, revision 3: <a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a></li> +</ul> +<p>Firefox 1.5 supports the following data transport protocols (HTTP, FTP, SSL, TLS, and others), multilingual character data (Unicode), graphics (GIF, JPEG, PNG, SVG, and others) and the latest version of the world's most popular scripting language, <a href="/en-US/docs/New_in_JavaScript_1.6" title="en-US/docs/New_in_JavaScript_1.6">JavaScript 1.6</a>.</p> +<h2 id="Changes_since_Firefox_1.0">Changes since Firefox 1.0</h2> +<p>Many changes have been introduced into Firefox since it was first released on November 9, 2004. Firefox has progressed with many new features and bug fixes. A detailed list of changes is available from <a class="external" href="http://www.squarefree.com/burningedge/releases/1.5-comprehensive.html">squarefree.com</a>.</p> diff --git a/files/zh-tw/mozilla/firefox/releases/10/index.html b/files/zh-tw/mozilla/firefox/releases/10/index.html new file mode 100644 index 0000000000..1226e5de82 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/10/index.html @@ -0,0 +1,209 @@ +--- +title: Firefox 10 技術文件 +slug: Mozilla/Firefox/Releases/10 +translation_of: Mozilla/Firefox/Releases/10 +--- +<div>{{FirefoxSidebar}}</div> + +<p>Firefox 10 shipped on January 31, 2012. This article provides information about the new features and key bugs fixed in this release, as well as links to more detailed documentation for both web developers and add-on developers.</p> + +<p>This documentation is not yet complete. Want to help document Firefox 10? See the <a class="external" href="http://beta.elchi3.de/doctracker/#list=fx&version=10.0" title="http://beta.elchi3.de/doctracker/#list=fx&version=10.0">list of bugs that need to be written about</a> and pitch in!</p> + +<div class="note"><strong>Important note: </strong>Firefox 10 is the first release of this browser with two digits. This may lead to problem with some UA-sniffing scripts. Be sure to check them, and those contained in 3rd-party software you embed in your pages, like libraries. For more information about this, look at the <a class="external" href="http://hacks.mozilla.org/2012/01/firefox-goes-2-digit-time-to-check-your-ua-sniffing-scripts/" title="http://hacks.mozilla.org/2012/01/firefox-goes-2-digit-time-to-check-your-ua-sniffing-scripts/">Firefox goes 2-digit article on hack.mozilla.org</a>.</div> + +<h2 id="Changes_for_Web_developers">Changes for Web developers</h2> + +<h3 id="HTML">HTML</h3> + +<ul> + <li>The new HTML5 {{ HTMLElement("bdi") }} element, bi-directional isolation, allowing isolation of parts of text with a different directionality has been implemented. This is especially useful when displaying text with an unknown directionality, coming from a database for example, in the middle of text with a known, and potentially, different one.</li> + <li>You may now specify a fragment of "top" for the {{ htmlattrxref("href", "a") }} attribute to create a link to the top of the page. This used to work, then went away for a while, and now it's back, for compatibility with the HTML5 specification. For example: <code><a href="#top">Return to top of page</a></code>.</li> +</ul> + +<h3 id="JavaScript">JavaScript</h3> + +<ul> + <li>The method <code><a href="/en/JavaScript/Reference/Global_Objects/WeakMap" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/WeakMap">WeakMap</a>.set()</code> now returns <em><code>undefined</code></em>, instead of itself.</li> + <li>A bug was introduced in regular expression handling in Firefox 7; this has been fixed. See {{ bug(683838) }} if you want the gory details.</li> + <li>You can no longer use <a href="/en/E4X" title="E4X">E4X</a> syntax while in <a href="/en/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="Strict mode">ECMAScript 5 strict mode</a> (that is, after <code>"use strict;"</code>).</li> +</ul> + +<h3 id="DOM">DOM</h3> + +<h4 id="DOM3_Events">DOM3 Events</h4> + +<ul> + <li>The DOM Event method <a href="/en/DOM/event.stopImmediatePropagation" title="event.stopImmediatePropagation"><code>event.stopImmediatePropagation</code></a> has been implemented.</li> + <li>The mouse events <code>mouseenter</code> and <code>mouseleave</code> have been implemented.</li> +</ul> + +<h4 id="DOM4">DOM4</h4> + +<ul> + <li>The attribute {{ domxref("document.xmlVersion") }} (which was only gettable and not settable) has been removed as it has been deprecated in the DOM4 specification. The article for {{ domxref("document.xmlVersion") }} now suggests a way to detect whether the document is HTML or XML without using that property.</li> + <li>The attribute {{ domxref("document.xmlStandalone") }} has been removed as it has been deprecated in the DOM4 specification.</li> + <li>The attribute {{ domxref("document.xmlEncoding") }} has been removed as it has been deprecated in the DOM4 specification.</li> + <li>The attribute {{ domxref("text.isElementContentWhiteSpace") }} has been removed as it has been deprecated in the DOM4 specification.</li> + <li>The method {{ domxref("text.replaceWholeText") }} has been removed as it has been deprecated in the DOM4 specification.</li> + <li>The method {{ domxref("node.isSameNode") }} has been removed as it has been deprecated in the DOM4 specification. Instead of <code><em>node1</em>.isSameNode(<em>node2</em>)</code>, you can simply use the <code>===</code> operator, like this: <code><em>node1 </em>===</code><code><em> node2</em></code>.</li> +</ul> + +<h4 id="Page_Visibility_API">Page Visibility API</h4> + +<ul> + <li>The <a href="/en/DOM/Using_the_Page_Visibility_API" title="Using the Page Visibility API">Page Visibility API</a> has been implemented (prefixed): <code>document.mozHidden</code>, <code>document.mozVisibilityState</code> are available and the event <code>mozvisibilitychanged</code> is sent when the state is modified.</li> +</ul> + +<h4 id="Full_Screen_API">Full Screen API</h4> + +<ul> + <li>Support for {{ domxref("document.mozFullScreenEnabled") }} has been added.</li> + <li>The new {{ cssxref(":-moz-full-screen-ancestor") }} property has been added. This lets you match against elements that are ancestors of an element in full screen mode.</li> +</ul> + +<h4 id="Battery_API">Battery API</h4> + +<ul> + <li>Experimental support for {{ domxref("window.navigator.mozBattery") }} has been added (can be enabled setting the preference <code>dom.battery.enabled</code> to <code>true</code> and will be enabled by default starting with Firefox 11).</li> +</ul> + +<h4 id="Canvas">Canvas</h4> + +<ul> + <li>The <a href="/en/DOM/CanvasRenderingContext2D#createPattern%28%29" title="en/DOM/CanvasRenderingContext2D#createPattern%28%29"><code>createPattern()</code></a> method now throws an exception if a zero-sized source canvas is specified.</li> + <li>If you use a non-finite value for any of the numeric parameters to <a href="/en/DOM/CanvasRenderingContext2D#putImageData%28%29" title="en/DOM/CanvasRenderingContext2D#putImageData%28%29"><code>putImageData()</code></a>, the call is now silently ignored instead of throwing an exception, in keeping with the specification.</li> +</ul> + +<h4 id="WebGL">WebGL</h4> + +<ul> + <li>Firefox 10 now supports the <a class="external" href="http://www.khronos.org/registry/webgl/extensions/OES_standard_derivatives/" title="http://www.khronos.org/registry/webgl/extensions/OES_standard_derivatives/"><code>OES_standard_derivatives</code></a> extension.</li> + <li><a href="/en/WebGL#WebGL_debugging_and_testing" title="en/WebGL#WebGL_debugging_and_testing">New preferences have been added</a> to help test WebGL code for compatibility with minimally-capable devices on your full development platform.</li> +</ul> + +<h4 id="Web_Workers">Web Workers</h4> + +<ul> + <li>The attribute <code>XMLHttpRequest.responseType</code> and <code>XMLHttpRequest.response</code> are now available from inside <a href="/en/DOM/Worker/Functions_available_to_workers#section_2" title="https://developer.mozilla.org/En/DOM/Worker/Functions_available_to_workers#section_2">Workers</a>.</li> + <li>The <a href="/en/DOM/Worker#Worker()" title="En/DOM/Worker#Worker()"><code>Worker()</code></a> constructor now accepts <a href="/en/data_URIs" title="data URIs">data URIs</a>.</li> +</ul> + +<h4 id="IndexedDB">IndexedDB</h4> + +<p>Great progress has been made to update IndexedDB to the latest draft specification. This effort will continue in Firefox 11.</p> + +<ul> + <li>The <a href="/en/IndexedDB/IDBIndex#count" title="en/IndexedDB/IDBIndex#count"><code>IDBIndex.count()</code></a> and <a href="/en/IndexedDB/IDBObjectStore#count" title="en/IndexedDB/IDBObjectStore#count"><code>IDBObjectStore.count()</code></a> methods have been added.</li> + <li>The <a href="/en/IndexedDB/IDBCursor#advance" title="en/IndexedDB/IDBCursor#advance"><code>IDBCursor.advance()</code></a> method has been added.</li> + <li>When encountering an unknown optional parameter in <a href="/en/IndexedDB/IDBObjectStore#createIndex" title="https://developer.mozilla.org/en/IndexedDB/IDBObjectStore#createIndex"><code>IDBObjectStore.createIndex()</code></a> or <a href="/en/IndexedDB/IDBDatabase#createObjectStore" title="en/IndexedDB/IDBDatabase#createObjectStore"><code>IDBDatabase.createObjectStore()</code></a>, Gecko will not fire an exception anymore, but simply ignore it.</li> + <li>When <a href="/en/IndexedDB/IDBTransaction#abort%28%29" title="https://developer.mozilla.org/en/IndexedDB/IDBTransaction#abort%28%29"><code>IDBTransaction.abort()</code></a> is called, all pending <a href="/en/IndexedDB/IDBRequest" title="IDBRequest"><code>IDBRequest</code></a> have their <code>errorCode</code> set to <code>ABORT_ERROR</code>.</li> + <li>The methods <a href="/en/IndexedDB/IDBObjectStore#delete()" title="en/IndexedDB/IDBObjectStore#delete()"><code>IDBObjectStore.delete()</code></a> and <a href="/en/IndexedDB/IDBCursor#delete()" title="en/IndexedDB/IDBCursor#delete()"><code>IDBCursor.delete()</code></a> now set the <code>result</code> attribute of the returned <a href="/en/IndexedDB/IDBRequest" title="en/IndexedDB/IDBRequest"><code>IDBRequest</code></a> to <code>undefined</code>.</li> + <li>The method <a href="/en/IndexedDB/IDBDatabase#setVersion()" title="en/IndexedDB/IDBDatabase#setVersion()"><code>IDBDatabase.setVersion()</code></a> has been removed as it was removed from the latest spec. The version of the database is given through the <a href="/en/IndexedDB/IDBFactory#open" title="en/IndexedDB/IDBFactory#open"><code>IDBFactory.open()</code></a> method which has been updated and the <code>onupgradeneeded </code>callback allows the schema of the database to be upgraded. The version itself has been changed from a <code>DOMString</code> to an <code>unsigned long long</code>. The <a href="/en/IndexedDB/IDBVersionChangeRequest" title="en/IndexedDB/IDBVersionChangeRequest"><code>IDBVersionChangeRequest</code></a> interface has been removed and replaced by the new <a href="/en/IndexedDB/IDBOpenDBRequest" title="en/IndexedDB/IDBOpenDBRequest"><code>IDBOpenDBRequest</code></a> interface.</li> + <li>The method <a href="/en/IndexedDB/IDBFactory#deleteDatabase%28%29" title="en/IndexedDB/IDBFactory#deleteDatabase%28%29"><code>IDBFactory.deleteDatabase()</code></a> method has been added.</li> +</ul> + +<h4 id="Other">Other</h4> + +<ul> + <li>When the proper MIME type is passed, <code>image/svg+xml</code>, <a href="/en/DOM/DOMParser#Parsing_a_SVG_document" title="https://developer.mozilla.org/en/DOM/DOMParser#Parsing_a_SVG_document">the <code>DOMParser</code> now creates a <code>SVGDocument</code></a> when given a string with SVG.</li> + <li>In the past, when {{ domxref("element.setAttribute()") }} parsed integers, it would report an error if the integer included any non-numeric characters (for example "42foo"). Now it correctly truncates this as the number 42, in accordance with the specification.</li> + <li>The ESC key no longer incorrectly results in the {{ domxref("window.oninput") }} handler incorrectly getting called.</li> + <li>The {{ domxref("NameList") }} interface is no longer implemented; it previously had an implementation with no way to actually get access to one.</li> + <li>The {{ domxref("document.createProcessingInstruction()") }} method now works on HTML documents as well as XML documents. {{ domxref("ProcessingInstruction") }} nodes are still only supported on XML documents, but since nodes can be moved among documents, it's helpful to be able to create them on HTML documents as well.</li> + <li>The {{ domxref("XMLHttpRequest") }} <code>responseType</code> "<code>moz-json</code>" <a href="/en/Firefox_9_for_developers#DOM" title="en/Firefox_9_for_developers#DOM">introduced in Firefox 9</a> has been updated to the latest draft of the specification and has been unprefixed. See {{ bug("707142#c13") }}</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<ul> + <li>CSS 3D Transforms are now supported. This includes support for the {{ cssxref("transform-style") }}, {{ cssxref("perspective") }}, {{ cssxref("perspective-origin") }} and {{ cssxref("backface-visibility") }} properties, as well as for 3D transform functions in the {{ cssxref("transform") }} and {{ cssxref("transform-function") }} properties. See <a href="/En/CSS/Using_CSS_transforms#3D_specific_CSS_properties" title="En/CSS/Using_CSS_transforms#3D_specific_CSS_properties">Using CSS transforms</a> for details.</li> + <li>Two new values for the CSS property {{ cssxref("unicode-bidi") }} have been added: <code>-moz-isolation</code> and <code>-moz-plaintext</code>. The <code>-moz-isolation</code> value isolates, from a directionality point of view, the element from its environment, letting it have a different directionality. An element with <code>unicode-bidi:-moz-isolation</code> behaves like a {{ HTMLElement("bdi") }} element. The <code>-moz-plaintext</code> indicates the browser to use the Unicode browser heuristic to determine directionality and not the CSS {{ cssxref("direction") }} property.</li> + <li>The CSS {{ cssxref("linear-gradient") }} and {{ cssxref("repeating-linear-gradient") }} properties have been updated to support the new <code>to</code> syntax and the <em>magic corner</em> algorithm. This allows to give a precise color on the corner of a gradient-filled box.</li> + <li>The {{ cssxref("text-overflow") }} property's handling of cases in which the box overflows on both sides while the <code>text-overflow</code> property is set to overflow on only one <a href="/en/CSS/text-overflow#Gecko_notes" title="en/CSS/text-overflow#Gecko_notes">has been corrected</a>.</li> + <li>Handling of the {{ cssxref("position") }} property on elements inside positioned {{ HTMLElement("table") }} elements <a href="/en/CSS/position#Gecko_notes" title="en/CSS/position#Gecko_notes">has been fixed</a>. <strong>This change will affect layout of pages; however, we now comply with the CSS specification and with other browsers, so this should be easy to fix.</strong></li> + <li>Margin collapsing around {{ HTMLElement("table") }} elements has been fixed to match the CSS specification. Previously, table elements' margins would not be collapsed along with other adjacent elements, leading to incorrect layout. <strong>This change will affect layout of pages; however, we now comply with the CSS specification and with other browsers, so this should be easy to fix.</strong></li> +</ul> + +<h3 id="SVG">SVG</h3> + +<ul> + <li>The {{ SVGElement("mask") }} element has been updated to support both sRGB and linearRGB, and now defaults to sRGB, in compliance with the latest revision of the SVG 1.1 specification.</li> +</ul> + +<h3 id="Networking">Networking</h3> + +<ul> + <li>The HTTP <code>Accept-Charset</code> header is no longer sent in HTTP requests. In its absence, servers should respond by sending UTF-8.</li> +</ul> + +<h3 id="Developer_tools">Developer tools</h3> + +<ul> + <li>The {{ domxref("console") }} object has two new methods, {{ domxref("console.time()") }} and {{ domxref("console.timeEnd()") }}, which can be used to set timers on a page.</li> + <li>The new <a href="/en/Tools/Page_Inspector" title="Page Inspector">Page Inspector</a> has been added, providing an excellent way to examine and manipulate the HTML and CSS behind your content.</li> +</ul> + +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> + +<p>For an overview of likely issues that may arise when updating your add-ons to support Firefox 10, see <a href="/en/Firefox/Updating_add-ons_for_Firefox_10" title="en/Firefox/Updating_add-ons_for_Firefox_10">Updating add-ons for Firefox 10</a>.</p> + +<div class="note"><strong>Note:</strong> The old <a href="/en/PRBool" title="PRBool"><code>PRBool</code></a> data type has been retired! Anywhere in the documentation that refers to it now uses the standard C++ <code>bool</code> type instead. Documentation will be updated in the future, but for now, just keep this in mind.</div> + +<h3 id="Manifests">Manifests</h3> + +<ul> + <li>Support for <a href="/en/Install_Manifests#strictCompatibility" title="en/Install_Manifests#strictCompatibility"><code><em:strictCompatibility></code></a> has been added to the install manifest. It allows add-ons authors to opt in to checking the maximum version of their extension. If set to <code>true</code> the add-on will be disabled if the application version is greater than <code><em:maxVersion></code>. Firefox 10 defaults to add-ons being compatible, regardless of their specified maximum version. This flag overrides that preference. You should set this if your add-on does things that are likely to be broken by Firefox updates, <strong>but not</strong> if your add-on has a binary component, since such add-ons always get strictly checked (remember that binary components must always be recompiled for each major Firefox release).</li> + <li>If you wish to revert to the old behavior -- that is, to strict compatibility checking for all add-ons, regardless of the value of the <code>strictCompatibility</code> flag in their manifests, you can set the <code>extensions.strictCompatibility</code> preference to <code>true</code>.</li> +</ul> + +<h3 id="XUL">XUL</h3> + +<ul> + <li>Bootstrapped add-ons using a <a href="/en/Chrome_Registration" title="en/chrome.manifest">chrome.manifest</a> file now have the manifest file registered automatically. See the section <a href="/en/Extensions/Bootstrapped_extensions#Adding_user_interface_with_a_chrome.manifest" title="en/Extensions/Bootstrapped_extensions#Adding_user_interface_with_a_chrome.manifest">Adding user interface with a chrome.manifest</a> for details.</li> +</ul> + +<h3 id="XPConnect">XPConnect</h3> + +<ul> + <li>Several new properties and methods have been added to <a href="/en/Components.utils" title="Components.utils"><code>Components.utils</code></a>, granting access to assorted debugging-related information.</li> +</ul> + +<h3 id="Interface_changes">Interface changes</h3> + +<ul> + <li>The {{ interface("mozISpellCheckingEngine") }} and {{ interface("nsIEditorSpellCheck") }} interfaces have been updated to allow restartless add-ons to add dictionaries to the spell checker. <strong>XXX need to <a href="/En/Using_an_External_Spell-checker" title="en/Using_an_External_Spell-checker">update docs</a> on how to actually do this.</strong></li> + <li>The {{ ifattribute("nsIBrowserHistory", "lastPageVisited") }} attribute has been removed.</li> + <li>The <code>nsIDocumentViewer</code> interface has been merged into {{ interface("nsIContentViewer") }}.</li> + <li>The {{ interface("nsIURIFixup") }} interface has a new flag, <code>FIXUP_FLAG_USE_UTF8</code>, which lets you tell it to use UTF-8 instead of the platform character set, when doing conversions.</li> +</ul> + +<h3 id="Plug-in_changes">Plug-in changes</h3> + +<ul> + <li>The <a href="/en/Gecko_Plugin_API_Reference/Plug-in_Development_Overview#Working_with_URLs" title="en/Gecko_Plugin_API_Reference/Plug-in_Development_Overview#Working_with_URLs">new variable <code>NPNVdocumentOrigin</code></a> has been added; this returns the document origin, and is more secure than {{ domxref("window.location") }}.</li> +</ul> + +<h3 id="Build_system_changes">Build system changes</h3> + +<ul> + <li>The <code>--disable-rdf</code> build option, which actually made it impossible to successfully build, has been removed. Work is ongoing on being able to actually remove RDF support entirely, but at present XUL still requires it to function. See {{ bug(559505) }} for progress on removing the last vestiges of RDF being required.</li> + <li>The <code>--disable-smil</code> build option has been removed.</li> +</ul> + +<h3 id="See_also">See also</h3> + +<ul> + <li><a href="/en/Firefox_9_for_developers" title="en/Firefox 9 for developers">Firefox 9 for developers</a></li> + <li><a href="/en/Firefox_8_for_developers" title="en/Firefox 8 for developers">Firefox 8 for developers</a></li> + <li><a href="/en/Firefox_7_for_developers" title="en/Firefox 7 for developers">Firefox 7 for developers</a></li> + <li><a href="/en/Firefox_6_for_developers" title="en/Firefox 6 for developers">Firefox 6 for developers</a></li> + <li><a href="/en/Firefox_5_for_developers" title="en/Firefox 5 for developers">Firefox 5 for developers </a></li> + <li><a href="/en/Firefox_4_for_developers" title="en/Firefox 4 for developers">Firefox 4 for developers </a></li> + <li><a href="/en/Firefox_3.6_for_developers" title="en/Firefox 3.6 for developers">Firefox 3.6 for developers </a></li> + <li><a href="/En/Firefox_3.5_for_developers" title="en/Firefox 3.5 for developers">Firefox 3.5 for developers</a></li> + <li><a href="/en/Firefox_3_for_developers" title="en/Firefox 3 for developers">Firefox 3 for developers</a></li> + <li><a href="/en/Firefox_2_for_developers" title="en/Firefox 2 for developers">Firefox 2 for developers</a></li> + <li><a href="/en/Firefox_1.5_for_developers" title="en/Firefox 1.5 for developers">Firefox 1.5 for developers</a></li> +</ul> + +<p>{{ languages( { "ja": "ja/Firefox_10_for_developers" } ) }}</p> diff --git a/files/zh-tw/mozilla/firefox/releases/11/index.html b/files/zh-tw/mozilla/firefox/releases/11/index.html new file mode 100644 index 0000000000..cd5895fe6d --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/11/index.html @@ -0,0 +1,111 @@ +--- +title: Firefox 11 技術文件 +slug: Mozilla/Firefox/Releases/11 +translation_of: Mozilla/Firefox/Releases/11 +--- +<div>{{FirefoxSidebar}}</div><p>Firefox 11 shipped on March 13, 2012. This article provides information about the new features and key bugs fixed in this release, as well as links to more detailed documentation for both web developers and add-on developers.</p> +<h2 id="Changes_for_Web_developers">Changes for Web developers</h2> +<h3 id="HTML">HTML</h3> +<ul> + <li>The attributes <code>muted</code> and <code>loop</code> on {{HTMLElement("audio")}} and {{HTMLElement("video")}} elements have been implemented.</li> +</ul> +<h3 id="DOM">DOM</h3> +<ul> + <li>The {{domxref("element.outerHTML")}} property is now supported on HTML elements.</li> + <li><a href="/en-US/docs/HTML_in_XMLHttpRequest" title="en-US/docs/HTML_in_XMLHttpRequest"><code>XMLHttpRequest</code> supports HTML parsing</a>.</li> + <li>Removed support for using the {{domxref("XMLHttpRequest")}} <code>responseType</code> and <code>withCredentials</code> attributes when performing synchronous requests. Attempting to do so throws an <code>NS_ERROR_DOM_INVALID_ACCESS_ERR</code> exception. This change has been proposed to the W3C for standardization.</li> + <li>The new {{domxref("window.navigator.mozVibrate()")}} method lets you vibrate the device where supported; this is implemented as <code>mozVibrate()</code> on Gecko.</li> + <li>{{domxref("window.navigator.mozApps")}} returns an <a href="/en-US/docs/DOM/Apps" title="Apps"><code>Apps</code></a> object you can use to install and manage <a href="/en-US/docs/Apps" title="en-US/docs/Apps">open web applications</a>.</li> + <li><code>MozBeforePaint</code> events are no longer fired. {{domxref("window.requestAnimationFrame", "mozRequestAnimationFrame()")}} consumers who used these should pass a callback function instead.</li> + <li>Support for canceling animation frame requests has been added; {{domxref("window.requestAnimationFrame", "window.mozRequestAnimationFrame()")}} now returns a request ID value, which you can pass to {{domxref("window.cancelAnimationFrame", "window.mozCancelAnimationFrame()")}} to cancel the request.</li> + <li>Several {{domxref("Event")}} constructors (<code>Event</code>, HTML events, <code>UIEvent</code>, and <code>MouseEvent</code>) introduced in DOM4 specifications are now supported.</li> + <li>The {{domxref("window.navigator.mozBattery", "Battery API")}} is now enabled by default.</li> + <li>Support for the <a href="/en-US/docs/DOM/HTMLMediaElement" title="en-US/docs/DOM/HTMLMediaElement"><code>defaultMuted</code></a>, <code><a href="/en-US/docs/DOM/HTMLMediaElement" title="en-US/docs/DOM/HTMLMediaElement">loop</a></code> and <a href="/en-US/docs/DOM/HTMLMediaElement" title="en-US/docs/DOM/HTMLMediaElement"><code>muted</code></a> properties on <a href="/en-US/docs/DOM/HTMLMediaElement" title="en-US/docs/DOM/HTMLMediaElement"><code>HTMLMediaElement</code></a> has been added.</li> + <li>Calling {{domxref("document.mozCancelFullScreen()")}} now restores the previously full-screen element if some other element was in full-screen mode when the current element's {{domxref("element.mozRequestFullScreen()")}} method was called.</li> + <li>The {{domxref("window.requestAnimationFrame", "window.mozRequestAnimationFrame()")}} method no longer supports a no-argument form. This form was not used much and is unlikely to become part of the standard.</li> + <li>SVG-as-an-image can now be drawn into a canvas without <a href="/en-US/docs/CORS_Enabled_Image#What_is_a_.22tainted.22_canvas.3F" title="en-US/docs/CORS_Enabled_Image#What_is_a_.22tainted.22_canvas.3F">tainting the canvas</a>.</li> + <li>The non-standard <code>countryCode</code> property of the <code>GeoPositionAddress</code> interface has been removed; see {{interface("nsIDOMGeoPositionAddress")}}.</li> + <li><a href="/en-US/docs/Server-sent_events" title="Server-sent events">Server-sent events</a> now support <a href="/en-US/docs/HTTP_access_control" title="HTTP access control (CORS)">CORS</a>.</li> + <li>In the past, when the user followed a link, the values set on the {{domxref("window.navigator")}} object were retained by the new page. Now a new <code>navigator</code> object is created for the new page. This makes Firefox behave like all other browsers.</li> +</ul> +<h3 id="CSS">CSS</h3> +<ul> + <li>the <a href="/en-US/docs/CSS/text-size-adjust" title="text-size-adjust"><code>text-size-adjust</code></a> property is now supported</li> + <li><a href="/en-US/docs/CSS/CSS3" title="CSS3">CSS3</a> <a href="/en-US/docs/CSS/CSS3#Conditional_Rules" title="CSS3 Conditional Rules">Conditional Rules</a> are now better supported: nested statements can now be added to <a href="/en-US/docs/CSS/@media" title="@media">@media</a>, <a href="/en-US/docs/CSS/@document" title="@document">@-moz-document</a>. (See <a href="/en-US/docs/CSS/Syntax" title="Syntax">CSS Syntax</a> and <a href="/en-US/docs/CSS/At-rule" title="At-rule">CSS at-rules</a>).</li> +</ul> +<h3 id="JavaScript">JavaScript</h3> +<p><em>No change.</em></p> +<h3 id="SVG">SVG</h3> +<ul> + <li>The {{domxref("SVGSVGElement")}} DOM interface now support the <code>getElementById</code> method.</li> +</ul> +<h3 id="WebSocket">WebSocket</h3> +<ul> + <li><a href="/en-US/docs/WebSockets" title="en-US/docs/WebSockets">WebSocket</a> API now supports binary messages (see {{bug("676439")}}).</li> + <li>Both the protocol and the API has been updated to the latest draft of the specification and the API has been unprefixed (see {{bug("666349")}} and {{bug("695635")}}).</li> + <li>Previously, messages sent and received using WebSockets in Firefox were limited to 16 MB in size; they may now be up to 2 GB (although memory capacity limitations may prevent them from being that large, Firefox supports it).</li> +</ul> +<h3 id="IndexedDB">IndexedDB</h3> +<ul> + <li>The support for <a href="/en-US/docs/IndexedDB/IDBFactory#cmp%28%29" title="https://developer.mozilla.org/en-US/docs/IndexedDB/IDBFactory#cmp%28%29">IDBFactory.cmp()</a> has been added.</li> + <li>An <a href="/en-US/docs/IndexedDB/Basic_Concepts_Behind_IndexedDB#section_6" title="https://developer.mozilla.org/en-US/docs/IndexedDB/Basic_Concepts_Behind_IndexedDB#section_6">IndexedDB key</a> can also be of one of the following types: Date, Arrays and Float (and not only String and Integer).</li> +</ul> +<h3 id="Network">Network</h3> +<ul> + <li>The change in Firefox 8 that removed support for double quote characters as delimiters for {{rfc(2231)}} and {{rfc(5987)}} has been reverted, as this broke some sites, including Outlook Web Access.</li> + <li>The user agent string in HTTP headers now includes an identifier that <a href="/en-US/docs/Gecko_user_agent_string_reference#Mobile_and_Tablet_indicators" title="en-US/docs/Gecko_user_agent_string_reference#Mobile_and_Tablet_indicators">lets the server know if the Firefox accessing it is a phone or a tablet</a>.</li> +</ul> +<h3 id="Developer_tools">Developer tools</h3> +<ul> + <li>The <a href="/en-US/docs/Tools/Page_Inspector" title="Page Inspector">Page Inspector</a> now offers a <a href="/en-US/docs/Tools/Page_Inspector/3D_view" title="3D view">3D view</a> if your system supports <a href="/en-US/docs/WebGL" title="WebGL">WebGL</a>.</li> + <li>The new <a href="/en-US/docs/Tools/Style_Editor" title="Style Editor">Style Editor</a> provides a free-form way to edit and compose CSS style sheets in real-time.</li> + <li>The <a href="/en-US/docs/View_source" title="https://developer.mozilla.org/en-US/docs/View_source">View Source feature</a> now uses the new HTML5 parser instead of the old HTML parser.</li> +</ul> +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> +<h3 id="JavaScript_code_modules">JavaScript code modules</h3> +<h4 id="NetUtil.jsm">NetUtil.jsm</h4> +<ul> + <li><a href="/en-US/docs/JavaScript_code_modules/NetUtil.jsm#readInputStreamToString()" title="en-US/docs/JavaScript_code_modules/NetUtil.jsm#readInputStreamToString()"><code>readInputStreamToString()</code></a> has a new, optional, parameter to configure the character set interpretation while reading the input stream.</li> +</ul> +<h4 id="New_JavaScript_code_modules">New JavaScript code modules</h4> +<dl> + <dt> + <a href="/en-US/docs/JavaScript_code_modules/source-editor.jsm" title="source-editor.jsm"><code>source-editor.jsm</code></a></dt> + <dd> + Provides a convenient, easy-to-use source code editor that you can use in your add-ons. This is the same editor used by <a href="/en-US/docs/Tools/Scratchpad" title="Scratchpad">Scratchpad</a> and other developer tools integrated into Firefox.</dd> +</dl> +<h3 id="Interface_changes">Interface changes</h3> +<ul> + <li>The {{interface("mozIAsyncHistory")}} interface has a new method {{ifmethod("mozIAsyncHistory","isURIVisited")}} to check if a URI has been visited.</li> + <li>A new interface {{interface("mozIVisitStatusCallback")}} has been added to provide callback handling functionality for {{ifmethod("mozIAsyncHistory","isURIVisited")}}.</li> + <li>The {{interface("nsIMacDockSupport")}} interface now supports adding a text badge to the application's icon in the Dock using its new <code>badgeText</code> attribute.</li> + <li>In the {{interface("nsINavHistoryResultObserver")}} interface, you now need to implement {{ifmethod("nsINavHistoryResultObserver", "containerStateChanged")}} instead of the obsolete <code>containerOpened()</code> and <code>containerClosed()</code> methods.</li> +</ul> +<h4 id="Removed_interfaces">Removed interfaces</h4> +<p>The following interfaces were implementation details that are no longer needed:</p> +<ul> + <li>{{interface("nsICharsetResolver")}}</li> + <li>{{interface("nsIDOMNSElement")}}, see <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=707576" title="https://bugzilla.mozilla.org/show_bug.cgi?id=707576">bug707576</a>, use {{interface("nsIDOMElement")}} instead.</li> +</ul> +<h3 id="Theme-related_changes">Theme-related changes</h3> +<ul> + <li>The <code>omni.jar</code> file is now called <a href="/en-US/docs/Mozilla/About_omni.ja_(formerly_omni.jar)" title="en-US/docs/Mozilla/About_omni.ja_%28formerly_omni.jar%29"><code>omni.ja</code></a>.</li> +</ul> +<h3 id="Preference_changes">Preference changes</h3> +<dl> + <dt> + {{Pref("ui.tooltipDelay")}}</dt> + <dd> + Specifies the delay, in milliseconds, between the mouse cursor beginning to hover and the display of a tooltip.</dd> +</dl> +<h3 id="Build_system_changes">Build system changes</h3> +<ul> + <li>The <code>--enable-tracejit</code> build option has been removed.</li> +</ul> +<h3 id="Other_changes">Other changes</h3> +<ul> + <li>Add-ons that have not been updated in a long time are no longer assumed to be compatible by default; this is currently add-ons that indicate a <code>maxVersion</code> of 4.0.</li> +</ul> +<h2 id="See_also">See also</h2> +<div> + {{Firefox_for_developers('10')}}</div> diff --git a/files/zh-tw/mozilla/firefox/releases/2/adding_feed_readers_to_firefox/index.html b/files/zh-tw/mozilla/firefox/releases/2/adding_feed_readers_to_firefox/index.html new file mode 100644 index 0000000000..79a12bae1d --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/2/adding_feed_readers_to_firefox/index.html @@ -0,0 +1,36 @@ +--- +title: 新增消息來源閱讀工具 +slug: Mozilla/Firefox/Releases/2/Adding_feed_readers_to_Firefox +translation_of: Mozilla/Firefox/Releases/2/Adding_feed_readers_to_Firefox +--- +<div>{{FirefoxSidebar}}</div><p>從 Firefox 2 起,消息來源(feed)可選用不同的 RSS 或 Atom 閱讀工具訂閱。這份文件提供新增其他閱讀程式支援的方法。 +</p> +<h2 id="新增_Web_版閱讀工具">新增 Web 版閱讀工具</h2> +<p>新增 Web 版閱讀工具需要三個設定: +</p> +<dl><dt> <code>browser.contentHandlers.types.<i>number</i>.title</code> +</dt><dd> 閱讀程式的名稱。 +</dd><dt> <code>browser.contentHandlers.types.<i>number</i>.type</code> +</dt><dd> 這部份必須設定為「application/vnd.mozilla.maybe.feed」。 +</dd><dt> <code>browser.contentHandlers.types.<i>number</i>.uri</code> +</dt><dd> 閱讀程式的 URI。其中以「%s」標示消息來源 URL 必須插入的地方。 +</dd></dl> +<p><code><i>number</i></code> 應該替換成尚未使用的最小自然數。舉例來說,如果要新增一個名為「Easy Reader」的閱讀工具、且目前 0 到 4 皆已使用,則應將 <code><i>number</i></code> 設定為 5,如下: +</p> +<ul><li> <code>browser.contentHandlers.types.5.title</code>: Easy Reader +</li><li> <code>browser.contentHandlers.types.5.type</code>: application/vnd.mozilla.maybe.feed +</li><li> <code>browser.contentHandlers.types.5.uri</code>: <span class="nowiki">http://www.theeasyreaderurl.com?feed=%s</span> +</li></ul> +<p>你可以用 <tt>about:config</tt> 手動加入這些設定,如果擴充套件要新增閱讀工具則亦可寫程式修改之。 +</p> +<h3 id="從_Web_應用程式新增閱讀工具">從 Web 應用程式新增閱讀工具</h3> +<p>使用 JavaScript 也可輕易新增消息來源的閱讀工具,只要用 <code>navigator.registerContentHandler()</code> 函式即可,如下: +</p> +<pre>navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", + "http://www.theeasyreaderurl.com?feed=%s", + "Easy Reader"); +</pre> +<h2 id="新增本機閱讀程式">新增本機閱讀程式</h2> +<p>新增本機閱讀程式時,最簡單的方式便是使用「選項」(或「偏好設定」,名稱視作業系統而定)的「消息來源」面板直接添加。 +</p><p>當然也可以用擴充套件,改以程式方式新增閱讀程式。只要將<code>browser.feeds.handlers.application</code> 設定為閱讀程式的路徑即可。 +</p>{{ languages( { "en": "en/Adding_feed_readers_to_Firefox", "es": "es/A\u00f1adir_lectores_de_canales_a_Firefox", "ja": "ja/Adding_feed_readers_to_Firefox" } ) }} diff --git a/files/zh-tw/mozilla/firefox/releases/2/index.html b/files/zh-tw/mozilla/firefox/releases/2/index.html new file mode 100644 index 0000000000..a68f4fcbac --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/2/index.html @@ -0,0 +1,89 @@ +--- +title: Firefox 2 技術文件 +slug: Mozilla/Firefox/Releases/2 +translation_of: Mozilla/Firefox/Releases/2 +--- +<div>{{FirefoxSidebar}}</div><h2 id="Firefox_2_的開發相關特色">Firefox 2 的開發相關特色</h2> +<p>Firefox 2 有許多新的特色及功能,本文提供各項新特色的相關文章連結。 +</p> +<h3 id="給網頁設計師及開發者">給網頁設計師及開發者</h3> +<dl><dt> <a class="external" href="http://wiki.mozilla.org/Microsummaries">即時摘要</a> +</dt><dd> 即時摘要能定期顯示網頁中的關鍵訊息。網站或其他第三方開發者都能提供即時摘要來源,而後使用者能選擇在書籤上顯示即時摘要或網頁標題。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e8%a3%bd%e4%bd%9c%e5%8d%b3%e6%99%82%e6%91%98%e8%a6%81">製作即時摘要</a> +</dt><dd> 即時摘要來源的製作教學。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e5%8d%b3%e6%99%82%e6%91%98%e8%a6%81_XML_%e8%aa%9e%e6%b3%95%e5%8f%83%e8%80%83">即時摘要 XML 語法參考</a> +</dt><dd> 即時摘要來源之 XML 語法參考指南。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e8%a3%bd%e4%bd%9c_OpenSearch_%e6%90%9c%e5%b0%8b%e6%a8%a1%e7%b5%84">製作 OpenSearch 搜尋模組</a> +</dt><dd> Firefox 2 支援 OpenSearch 搜尋模組格式。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e8%a3%bd%e4%bd%9c_MozSearch_%e6%90%9c%e5%b0%8b%e6%a8%a1%e7%b5%84">製作 MozSearch 搜尋模組</a> +</dt><dd> Firefox 2 支援擴充版的 OpenSearch 格式,名為 MozSearch。但此非標準,故僅建議用於程式內部。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e8%ae%93%e6%90%9c%e5%b0%8b%e6%a8%a1%e7%b5%84%e6%94%af%e6%8f%b4%e6%90%9c%e5%b0%8b%e5%bb%ba%e8%ad%b0">讓搜尋模組支援搜尋建議</a> +</dt><dd> 讓你的 MozSearch 模組支援搜尋建議功能,此功能將於搜尋欄中以下拉選單顯示建議關鍵字。 +</dd></dl> +<dl><dt> <a href="zh_tw/JavaScript_1.7_%e6%96%b0%e5%8a%9f%e8%83%bd">JavaScript 1.7 新功能</a> +</dt><dd> Firefox 2 支援 JavaScript 1.7,包含新的 <code>let</code> 表達式、跨結構指定(destructuring assignment)、產生器 (generators)、迴圈器 (iterators) 和陣列簡約式 (array comprehensions)。 +</dd></dl> +<dl><dt> <a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side">WHATWG 於用戶端儲存工作階段資料</a> +</dt><dd> 於用戶端儲存工作階段資料技術可讓網路應用程式於用戶端儲存結構化資料。 +</dd></dl> +<dl><dt> <a href="zh_tw/Firefox_%e4%b8%ad%e7%9a%84_SVG">Firefox 中的 SVG</a> +</dt><dd> Firefox 2 提升支援 Scalable Vector Graphics (SVG) 的程度,實作了 <code><textPath></code> 元素、也開始支援某些從前無法妥善處理的屬性。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e6%8e%a7%e5%88%b6_HTML_%e8%a1%a8%e5%96%ae%e4%b8%ad%e7%9a%84%e6%8b%bc%e5%ad%97%e6%aa%a2%e6%9f%a5%e5%8a%9f%e8%83%bd">控制 HTML 表單中的拼字檢查功能</a> +</dt><dd> Firefox 2 支援文字輸入區的即時拼字檢查,本文描述撰寫 HTML 表單元素時啟用或停用此功能的方法。 +</dd></dl> +<dl><dt> <a href="zh_tw/Firefox_2_%e7%9a%84%e5%ae%89%e5%85%a8%e5%8a%9f%e8%83%bd">Firefox 2 的安全功能</a> +</dt><dd> 某些與安全相關之協定的預設啟用情形,在 Firefox 2 有了更動。 +</dd></dl> +<h3 id="給_XUL_與擴充套件開發者">給 XUL 與擴充套件開發者</h3> +<dl><dt> <a href="zh_tw/%e8%ae%93%e6%93%b4%e5%85%85%e5%a5%97%e4%bb%b6%e5%8d%87%e7%b4%9a%e8%87%b3_Firefox_2">讓擴充套件升級至 Firefox 2</a> +</dt><dd> 描述讓現有擴充套件升級以便支援 Firefox 2 的方法。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e8%b7%a8%e9%80%a3%e7%b7%9a%e5%84%b2%e5%ad%98_API">跨連線儲存 (Session store) API</a> +</dt><dd> Firefox 現在支援跨連線 (Session) 儲存或復原資料。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e6%b6%88%e6%81%af%e4%be%86%e6%ba%90%e5%85%a7%e5%ae%b9%e5%ad%98%e5%8f%96_API">消息來源內容存取 API</a> +</dt><dd> 讓開發者存取、解析 RSS 或 Atom 消息來源的 API。 +</dd></dl> +<dl><dt> <a href="zh_tw/SAX">SAX 支援</a> +</dt><dd> 事件驅動式的 XML 解析 API。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e8%87%aa%e7%b6%b2%e9%a0%81%e6%b7%bb%e5%8a%a0%e6%90%9c%e5%b0%8b%e5%bc%95%e6%93%8e">自網頁添加搜尋引擎</a> +</dt><dd> Firefox 能以 JavaScript 新增搜尋引擎模組,模組可為 OpenSearch 或 Sherlock 格式。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e6%96%bc_XUL_%e4%b8%ad%e4%bd%bf%e7%94%a8%e6%8b%bc%e5%ad%97%e6%aa%a2%e6%9f%a5">於 XUL 中使用拼字檢查</a> +</dt><dd> 如何使用拼字檢查功能及怎樣取得建議拼字清單的程式碼。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e6%96%b0%e5%a2%9e%e5%81%bd%e9%80%a0%e7%b6%b2%e7%ab%99%e6%b8%85%e5%96%ae%e4%be%86%e6%ba%90">新增偽造網站清單來源</a> +</dt><dd> Firefox 可以新增額外的詐騙網站資料來源,藉此提升偵測偽造網站的能力。 +</dd></dl> +<dl><dt> <a href="zh_tw/%e6%96%b0%e5%a2%9e%e6%b6%88%e6%81%af%e4%be%86%e6%ba%90%e9%96%b1%e8%ae%80%e5%b7%a5%e5%85%b7">新增消息來源閱讀工具</a> +</dt><dd> 你可以用網頁或程式新增 Firefox 的消息來源閱讀工具。 +</dd></dl> +<dl><dt> <a href="zh_tw/Storage">Storage</a> +</dt><dd> Firefox 2 新增 mozStorage 功能,為基於 sqlite 的資料庫結構。 +</dd></dl> +<dl><dt> <a href="zh_tw/Firefox_2_%e4%bd%88%e6%99%af%e4%b8%bb%e9%a1%8c%e4%b9%8b%e6%9b%b4%e5%8b%95">Firefox 2 佈景主題之更動</a> +</dt><dd> 討論現有佈景主題更新以便支援 Firefox 2 的方法。 +</dd></dl> +<h2 id="給廣大使用者的新功能">給廣大使用者的新功能</h2> +<p>Firefox 2 提供比上個版本更簡潔的操作介面,強化的安全隱私保護,讓您上網更安全方便。 +</p> +<h3 id="使用操作體驗">使用操作體驗</h3> +<ul><li> <b>文字欄內拼字檢查</b> 讓你在填寫表單時更安心。 +</li><li> <b>即時摘要 (Microsummaries)</b> 提供另一種書籤顯示的方式,可以用網頁上的某段文字作為書籤標題,並自動更新以監視最新動態。這對股票族、網拍狂等非常有用。 +</li><li> <b>擴充套件管理員操作介面</b> 更友善。 +</li><li> <b>搜尋引擎管理員</b> 讓你可以重新排列順序或移除搜尋欄中的搜尋引擎。 +</li><li> <b>強化的分頁瀏覽</b> 在每個分頁上加入了關閉鈕、調整了關閉分頁後的切換行為及簡化的分頁選項。 +</li><li> <b>自動偵測搜尋引擎</b> 可讓你瀏覽到提供搜尋引擎的網站時直接安裝該引擎。 +</li><li> <b>搜尋建議</b> 會在你於搜尋欄中搜尋時,即時提供搜尋建議。 +</li></ul> +<h3 id="安全隱私保護">安全隱私保護</h3> +<ul><li> <b>詐騙網站防護</b> 會在你瀏覽偽造網站時發出警告。 +</li></ul> +{{ languages( { "ca": "ca/Firefox_2_per_a_desenvolupadors", "es": "es/Firefox_2_para_desarrolladores", "en": "en/Firefox_2_for_developers", "fr": "fr/Firefox_2_pour_les_d\u00e9veloppeurs", "it": "it/Firefox_2.0_per_Sviluppatori", "ja": "ja/Firefox_2_for_developers", "ko": "ko/Firefox_2_for_developers", "pl": "pl/Firefox_2_dla_programist\u00f3w", "pt": "pt/Firefox_2_para_desenvolvedores" } ) }} diff --git a/files/zh-tw/mozilla/firefox/releases/2/security_changes/index.html b/files/zh-tw/mozilla/firefox/releases/2/security_changes/index.html new file mode 100644 index 0000000000..d0a4b7ad5a --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/2/security_changes/index.html @@ -0,0 +1,29 @@ +--- +title: Firefox 2 的安全功能 +slug: Mozilla/Firefox/Releases/2/Security_changes +tags: + - 安全性 + - 待翻譯 +translation_of: Mozilla/Firefox/Releases/2/Security_changes +--- +<div>{{FirefoxSidebar}}</div><p>本文探討 Firefox 2 與安全性相關的變動。</p> + +<h2 id=".E4.B8.8D.E5.A4.A0.E5.AE.89.E5.85.A8.E7.9A.84.E7.B7.A8.E7.A2.BC.E6.96.B9.E5.BC.8F.E7.9A.86.E9.A0.90.E8.A8.AD.E9.97.9C.E9.96.89" name=".E4.B8.8D.E5.A4.A0.E5.AE.89.E5.85.A8.E7.9A.84.E7.B7.A8.E7.A2.BC.E6.96.B9.E5.BC.8F.E7.9A.86.E9.A0.90.E8.A8.AD.E9.97.9C.E9.96.89">不夠安全的編碼方式皆預設關閉</h2> + +<p><a href="zh_tw/Firefox_2">Firefox 2</a> 預設停用 SSLv2 及不夠安全的「export」編碼方式(金鑰長度小於 64 位元),改以 SSLv3 替代,這樣可以提高安全性。</p> + +<p>偏好的編碼方式為 <code>TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA</code> 及 <code>TLS_RSA_WITH_3DES_EDE_CBC_SHA</code>。有些伺服器則稱為 <code>SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA</code> 及 <code>SSL_RSA_WITH_3DES_EDE_CBC_SHA</code>。</p> + +<p>若 SSLv2 必須開啟,則可以將各項以 <code>security.ssl2.*</code> 開頭的使用偏好設定為 <code>true</code>。</p> + +<h2 id=".E6.96.B0.E7.89.B9.E8.89.B2" name=".E6.96.B0.E7.89.B9.E8.89.B2">新特色</h2> + +<ul> + <li>Firefox 2 支援 TLS 下的<a class="external" href="http://zh.wikipedia.org/wiki/%E6%A4%AD%E5%9C%86%E6%9B%B2%E7%BA%BF%E5%AF%86%E7%A0%81%E5%AD%A6">橢圓曲線密碼</a>。目前限於 256、384 及 521 位元(是 521 沒錯)。</li> + <li>Firefox 2 支援「TLS 伺服器名稱指示套件」(TLS server name indication extension)。「TLS 伺服器名稱指示套件」能用於在同一個網路位置(Network Address)中存在多個虛擬伺服器時建立安全連線,進一步的內容請參考「<a class="external" href="http://tools.ietf.org/html/rfc3546" title="http://tools.ietf.org/html/rfc3546">RFC 3546</a>」。</li> + <li>當 Firefox 2 傳送一個 <a class="external" href="http://en.wikipedia.org/wiki/Ocsp">OCSP</a> 請求到有效的網頁伺服器認證時,Firefox 會直接連線到該伺服器,而不會使用代理伺服器(Proxy Sever)。</li> +</ul> + +<h2 id=".E9.96.8B.E5.95.9F.E8.88.87.E9.97.9C.E9.96.89.E7.B7.A8.E7.A2.BC.E6.96.B9.E5.BC.8F" name=".E9.96.8B.E5.95.9F.E8.88.87.E9.97.9C.E9.96.89.E7.B7.A8.E7.A2.BC.E6.96.B9.E5.BC.8F">開啟與關閉編碼方式</h2> + +<p>透過在 URL 上打上 about:config,並且篩選 "ssl" 或 "tls",你可以得知 Firefox 2 支援哪些加密編碼,並且開啟或關閉這些加密方式。</p> diff --git a/files/zh-tw/mozilla/firefox/releases/3.6/index.html b/files/zh-tw/mozilla/firefox/releases/3.6/index.html new file mode 100644 index 0000000000..f053267778 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/3.6/index.html @@ -0,0 +1,301 @@ +--- +title: Firefox 3.6 技術文件 +slug: Mozilla/Firefox/Releases/3.6 +translation_of: Mozilla/Firefox/Releases/3.6 +--- +<div><section class="Quick_links" id="Quick_Links"> + <ol> + <li class="toggle"> + <details> + <summary>Firefox developer release notes</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Releases">Firefox developer release notes</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>擴充套件</summary> + <ol> + <li><a href="/zh-TW/Add-ons/WebExtensions">瀏覽器擴充功能</a></li> + <li><a href="/zh-TW/Add-ons/Themes">主題</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Firefox internals</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/">Mozilla project</a></li> + <li><a href="/zh-TW/docs/Mozilla/Gecko">Gecko</a></li> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Headless_mode">Headless mode</a></li> + <li><a href="/zh-TW/docs/Mozilla/JavaScript_code_modules">JavaScript 程式碼模組</a></li> + <li><a href="/zh-TW/docs/Mozilla/js-ctypes">JS-ctypes</a></li> + <li><a href="/zh-TW/docs/Mozilla/MathML_Project">MathML 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/MFBT">MFBT</a></li> + <li><a href="/zh-TW/docs/Mozilla/Projects">Mozilla 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/Preferences">Preference system</a></li> + <li><a href="/zh-TW/docs/Mozilla/WebIDL_bindings">WebIDL bindings</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XPCOM">XPCOM</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XUL">XUL</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Building and contributing</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions">建置教學</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options">Configuring build options</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/How_Mozilla_s_build_system_works">How the build system works</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Source_Code/Mercurial">Mozilla 原始碼</a></li> + <li><a href="/zh-TW/docs/Mozilla/Localization">在地化</a></li> + <li><a href="/zh-TW/docs/Mozilla/Mercurial">Mercurial</a></li> + <li><a href="/zh-TW/docs/Mozilla/QA">Quality assurance</a></li> + <li><a href="/zh-TW/docs/Mozilla/Using_Mozilla_code_in_other_projects">在我們的專案中使用 Mozilla 程式碼</a></li> + </ol> + </details> + </li> + </ol> +</section></div><p><a class="external" href="http://www.firefox.com/" title="http://www.firefox.com/">Firefox 3.6</a> offers support for new and developing web standards, increased performance, and an overall better experience for web users and developers. This page provides links to articles covering the new capabilities of Firefox 3.6.</p> + +<h2 id="For_web_site_and_application_developers">For web site and application developers</h2> + +<h3 id="CSS">CSS</h3> + +<dl> + <dt><a href="/en-US/docs/CSS/Using_CSS_gradients" title="en-US/docs/Using gradients">Using gradients</a></dt> + <dd>Firefox 3.6 adds support for the proposed <a href="/zh-TW/docs/Web/CSS/-moz-linear-gradient" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-linear-gradient</code></a> and <a href="/zh-TW/docs/Web/CSS/-moz-radial-gradient" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-radial-gradient</code></a> properties for <a href="/zh-TW/docs/Web/CSS/background" title="The documentation about this has not yet been written; please consider contributing!"><code>background</code></a>.</dd> + <dt><a href="/en-US/docs/CSS/Multiple_backgrounds" title="en-US/docs/CSS/Multiple backgrounds">Multiple backgrounds</a></dt> + <dd>The <a href="/zh-TW/docs/Web/CSS/background" title="The documentation about this has not yet been written; please consider contributing!"><code>background</code></a> property (as well as <a href="/zh-TW/docs/Web/CSS/background-color" title="background-color CSS property 是用來設定HTML元素的背景顏色,值可以是顏色亦可以是特定關鍵字-- transparent."><code>background-color</code></a>, <a href="/zh-TW/docs/Web/CSS/background-image" title="The documentation about this has not yet been written; please consider contributing!"><code>background-image</code></a>, <a href="/zh-TW/docs/Web/CSS/background-position" title="The documentation about this has not yet been written; please consider contributing!"><code>background-position</code></a>, <a href="/zh-TW/docs/Web/CSS/background-repeat" title="The documentation about this has not yet been written; please consider contributing!"><code>background-repeat</code></a>, and <a href="/zh-TW/docs/Web/CSS/background-attachment" title="The documentation about this has not yet been written; please consider contributing!"><code>background-attachment</code></a>) now supports multiple backgrounds. This lets you specify multiple backgrounds that are rendered atop one another in layers.</dd> + <dt><a href="/en-US/docs/CSS/Media_queries#Mozilla-specific_media_features" title="en-US/docs/CSS/Media queries#Mozilla-specific media features">Mozilla-specific media features</a></dt> + <dd>Media features have been added for Mozilla-specific system metrics, so that <a href="/en-US/docs/CSS/Media_queries" title="en-US/docs/CSS/Media queries">media queries</a> can be used to more safely check on the availability of features such as touch support.</dd> + <dt><a href="/en-US/docs/CSS/Scaling_background_images" title="en-US/docs/CSS/Scaling background images">Scaling background images</a></dt> + <dd>The <code>background-size </code>property from the <a class="external" href="http://dev.w3.org/csswg/css3-background/" title="http://dev.w3.org/csswg/css3-background/#the-background-size-property">CSS 3 Backgrounds and Borders draft</a> is now supported under the name <a href="/zh-TW/docs/Web/CSS/-moz-background-size" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-background-size</code></a>.</dd> + <dt><a href="/en-US/docs/WOFF" title="en-US/docs/About WOFF">WOFF font support</a></dt> + <dd><a href="/zh-TW/docs/Web/CSS/@font-face" title="The @font-face CSS at-rule allows authors to specify online fonts to display text on their web pages. By allowing authors to provide their own fonts, @font-face eliminates the need to depend on the limited number of fonts users have installed on their computers. The @font-face at-rule may be used not only at the top level of a CSS, but also inside any CSS conditional-group at-rule."><code>@font-face</code></a> now supports the WOFF downloadable font file format.</dd> + <dt><a href="/en-US/docs/CSS/pointer-events" title="en-US/docs/CSS/pointer-events">Pointer events</a></dt> + <dd>The <a href="/zh-TW/docs/Web/CSS/pointer-events" title="The documentation about this has not yet been written; please consider contributing!"><code>pointer-events</code></a> property lets content specify whether or not an element may be the target of mouse pointer events.</dd> +</dl> + +<h4 id="Miscellaneous_CSS_changes">Miscellaneous CSS changes</h4> + +<ul> + <li>The <a href="/en-US/docs/CSS/length#Relative_length_units" title="en-US/docs/CSS/length#Relative length units"><code>rem</code></a> length unit from <a class="external" href="http://www.w3.org/TR/css3-values/#lengths" title="http://www.w3.org/TR/css3-values/#lengths">CSS3 Values and Units</a> is now supported. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=472195" title="FIXED: support css3 root em ('rem' or 're') units">bug 472195</a></li> + <li><a href="/zh-TW/docs/Web/CSS/image-rendering" title="The documentation about this has not yet been written; please consider contributing!"><code>image-rendering</code></a> is supported for images, background images, videos and canvases. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=423756" title="FIXED: Request: Switch for authors to turn on/off bilinear filtering when enlarging images">bug 423756</a></li> + <li><a href="/zh-TW/docs/Web/CSS/text-align" title="The documentation about this has not yet been written; please consider contributing!"><code>text-align</code></a>:end is now supported. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=299837" title="FIXED: [FIX]add support for text-align: end">bug 299837</a></li> + <li>DOM changes to elements using the table <a href="/zh-TW/docs/Web/CSS/display" title="The documentation about this has not yet been written; please consider contributing!"><code>display</code></a> types now work much better.</li> + <li>Added <a href="/zh-TW/docs/Web/CSS/:-moz-locale-dir(ltr)" title="The documentation about this has not yet been written; please consider contributing!"><code>:-moz-locale-dir(ltr)</code></a> and <a href="/zh-TW/docs/Web/CSS/:-moz-locale-dir(rtl)" title="The documentation about this has not yet been written; please consider contributing!"><code>:-moz-locale-dir(rtl)</code></a> to make it easier to customize layouts based on whether the user interface is being displayed using a left-to-right or a right-to-left locale. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=478416" title="FIXED: Replace chromedir with something more sane">bug 478416</a></li> + <li>Added support for the <a href="/zh-TW/docs/Web/CSS/:indeterminate" title="The documentation about this has not yet been written; please consider contributing!"><code>:indeterminate</code></a> pseudo-class, which matches <code>checkbox</code> <a class="internal" href="/en-US/docs/HTML/Element/Input" title="en-US/docs/HTML/Element/input"><code>input</code></a> elements whose <code>indeterminate</code> attribute is <code>true</code>.</li> + <li>Windowed plugins are no longer displayed in CSS transforms, because they can't be transformed properly by the compositor.</li> +</ul> + +<h3 id="HTML">HTML</h3> + +<dl> + <dt><a href="/en-US/docs/Using_files_from_web_applications" title="en-US/docs/Using files from web applications">Using files from web applications</a></dt> + <dd>Support for the new HTML5 File API has been added to Gecko, making it possible for web applications to access local files selected by the user. This includes support for selecting multiple files using the <code>input type="file"</code> HTML element's new <code>multiple</code> attribute.</dd> + <dt>HTML5 video supports poster frames</dt> + <dd>The <code>poster</code> attribute is now supported for the <a class="internal" href="/en-US/docs/HTML/Element/Video" title="en-US/docs/HTML/Element/Video"><code>video</code></a> element, allowing content to specify a poster frame to be displayed until the video begins to play.</dd> + <dt>Checkboxes and radio buttons support the <code>indeterminate</code> property</dt> + <dd>HTML <a class="internal" href="/en-US/docs/HTML/Element/Input" title="en-US/docs/HTML/Element/input"><code>input</code></a> elements of types <code>checkbox</code> and <code>radio</code> now support the indeterminate property, which allows a third, "indeterminate" state.</dd> + <dt>Canvas image smoothing can be controlled</dt> + <dd>The new <a class="internal" href="/en-US/docs/Canvas_tutorial/Using_images#Controlling_image_scaling_behavior" title="en-US/docs/Canvas tutorial/Using images#Controlling image scaling behavior"><code>mozImageSmoothingEnabled</code></a> property can be used to turn on and off image smoothing when scaling in <a class="internal" href="/en-US/docs/HTML/Element/canvas" title="en-US/docs/HTML/Element/canvas"><code>canvas</code></a> elements.</dd> + <dt>Asynchronous script execution</dt> + <dd>By setting the <code>async</code> attribute on a <a href="/en-US/docs/HTML/Element/Script" title="en-US/docs/HTML/Element/Script"><code>script</code></a> element, the <code>script</code> will not block loading or display of the rest of the page. Instead the <code>script</code> executes as soon as it is downloaded.</dd> +</dl> + +<h3 id="JavaScript">JavaScript</h3> + +<p>Gecko 1.9.2 introduces JavaScript 1.8.2, which adds a number of language features from the <a href="/en-US/docs/JavaScript/ECMAScript_5_support_in_Mozilla" title="https://developer.mozilla.org/en-US/docs/JavaScript/ECMAScript_5_support_in_Mozilla">ECMAScript 5 standard</a>:</p> + +<ul> + <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse" title="en-US/docs/Core JavaScript 1.5 Reference/Global Objects/Date/parse"><code>Date.parse()</code></a> can now parse ISO 8601 dates like YYYY-MM-DD.</li> + <li> + <p>The <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/prototype" title="en-US/docs/Core JavaScript 1.5 Reference/Global Objects/Function/prototype"><code>prototype</code></a> property of function instances is no longer enumerable.</p> + </li> +</ul> + +<dl> +</dl> + +<h3 id="DOM">DOM</h3> + +<dl> + <dt>Web workers can now self-terminate</dt> + <dd><a href="/en-US/docs/DOM/Using_web_workers" title="en-US/docs/Using web workers">Workers</a> now support the <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIWorkerScope#close()">nsIWorkerScope.close()</a></code> method, which allows them to terminate themselves.</dd> + <dt>Drag and drop now supports files</dt> + <dd>The <a href="/en-US/docs/DragDrop/DataTransfer" title="en-US/docs/DragDrop/DataTransfer"><code>DataTransfer</code></a> object provided to drag listeners now includes a list of files that were dragged.</dd> + <dt>Checking to see if an element matches a specified CSS selector</dt> + <dd>The new <a href="/zh-TW/docs/Web/API/Node/mozMatchesSelector" title="The documentation about this has not yet been written; please consider contributing!"><code>element.mozMatchesSelector</code></a> method lets you determine whether or not an element matches a specified CSS selector. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=518003" title="FIXED: implement function to check whether element matches a CSS selector">bug 518003</a>.</dd> + <dt><a href="/en-US/docs/Detecting_device_orientation" title="en-US/docs/Detecting device orientation">Detecting device orientation</a></dt> + <dd>Content can now detect the orientation of the device if it has a supported accelerometer, using the <a href="/en-US/docs/DOM/MozOrientation" title="en-US/docs/DOM/MozOrientation"><code>MozOrientation</code></a> event. Firefox 3.6 supports the accelerometer in Mac laptops.</dd> + <dt><a href="/en-US/docs/DOM/Detecting_document_width_and_height_changes" title="en-US/docs/DOM/Detecting document width and height changes">Detecting document width and height changes</a></dt> + <dd>The new <code>MozScrollAreaChanged</code> event is dispatched whenever the document's <code>scrollWidth</code> and/or <code>scrollHeight</code> properties change.</dd> +</dl> + +<h4 id="Miscellaneous_DOM_changes">Miscellaneous DOM changes</h4> + +<ul> + <li>The <code>getBoxObjectFor()</code> method has been <strong>removed</strong>, as it was non-standard and exposed even more non-standard stuff to the web. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=340571" title="FIXED: getBoxObjectFor leaking-onto-the-Web disaster">bug 340571</a>. Also affects <a class="external" href="http://mootools.net/" title="http://mootools.net/">MooTools</a> which uses this call for Gecko detection; this has been fixed in the latest version of MooTools, so be sure to update.</li> + <li>The new <a class="internal" href="/en-US/docs/DOM/window.mozInnerScreenX" title="en-US/docs/DOM/window.mozInnerScreenX"><code>mozInnerScreenX</code></a> and <a class="internal" href="/en-US/docs/DOM/window.mozInnerScreenY" title="en-US/docs/DOM/window.mozInnerScreenY"><code>mozInnerScreenY</code></a> properties on DOM windows have been added; these return the screen coordinates of the top-left corner of the window's viewport.</li> + <li>The new <code>mozScreenPixelsPerCSSPixel</code> attribute on the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindowUtils" title="">nsIDOMWindowUtils</a></code> interface, accessible only to chrome, provides a conversion factor between CSS pixels and screen pixels; this value can vary based on the zoom level of the content.</li> + <li>When the page's URI's document fragment identifier (the part after the "#" (hash) character) changes, a new <code>hashchange</code> event is sent to the page. See <a class="internal" href="/en-US/docs/DOM/window.onhashchange" title="window.onhashchange">window.onhashchange</a> for more information. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=385434" title="FIXED: Add support for HTML5 onhashchange (event for named anchor changes)">bug 385434</a></li> + <li>The attribute <a class="internal" href="/en-US/docs/DOM/document.readyState" title="en-US/docs/DOM/document.readyState"><code>document.readyState</code></a> is now supported. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=347174" title='FIXED: Implement document.readystate == "complete"'>bug 347174</a></li> + <li>Support for HTML5's <code><a class="internal" href="/en-US/docs/DOM/element.classList" title="element.classList">element.classList</a></code> to allow easier handling of the class attribute. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=501257" title="FIXED: Implement HTML 5's HTMLElement.classList property">bug 501257</a></li> + <li><code>localName</code> and <code>namespaceURI</code> in HTML documents now behave like they do in XHTML documents: <code>localName</code> returns in lower case and <code>namespaceURI</code> for HTML elements is <code>"<a class="external" href="http://www.w3.org/1999/xhtml" rel="freelink">http://www.w3.org/1999/xhtml</a>"</code>.</li> + <li><a href="/en-US/docs/DOM/element.getElementsByTagNameNS" title="en-US/docs/DOM/element.getElementsByTagNameNS"><code>element.getElementsByTagNameNS</code></a> no longer lowercases its argument, so upper-case ASCII letters in the argument make matches against HTML elements fail. The same is true for <a href="/en-US/docs/DOM/document.getElementsByTagNameNS" title="en-US/docs/DOM/document.getElementsByTagNameNS"><code>document.getElementsByTagNameNS</code></a>.</li> + <li>Support has been added for addresses in geolocation via the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMGeoPositionAddress" title="">nsIDOMGeoPositionAddress</a></code> interface and a new field added to <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMGeoPosition" title="">nsIDOMGeoPosition</a></code>.</li> + <li>The <a href="/zh-TW/docs/Web/API/Window/getComputedStyle" title="Window.getComputedStyle() 方法可以得到元素於套用啟用之樣式表以及解析其中可能包含的任何基本運算後的所有 CSS 屬性值。"><code>window.getComputedStyle</code></a> function now returns quotes within <code>url()</code> values.</li> +</ul> + +<h3 id="XPath">XPath</h3> + +<dl> + <dt>The choose() XPath method is now supported</dt> + <dd>The <a href="/en-US/docs/XPath/Functions/choose" title="en-US/docs/XPath/Functions/choose"><code>choose()</code></a> method is now supported by our implementation of <a href="/en-US/docs/XPath" title="en-US/docs/XPath">XPath</a>.</dd> +</dl> + +<h2 id="For_XUL_and_add-on_developers">For XUL and add-on developers</h2> + +<p>If you're an extension developer, you should start by reading <a class="internal" href="/en-US/docs/Updating_extensions_for_Firefox_3.6" title="en-US/docs/Updating extensions for Firefox 3.6">Updating extensions for Firefox 3.6</a>, which offers a helpful overview of what changes may affect your extension. Plug-in developers should read <a class="internal" href="/en-US/docs/Updating_plug-ins_for_Firefox_3.6" title="en-US/docs/Updating plug-ins for Firefox 3.6">Updating plug-ins for Firefox 3.6</a>.</p> + +<h3 id="New_features">New features</h3> + +<dl> + <dt><a href="/en-US/docs/Detecting_device_orientation" title="en-US/docs/Detecting device orientation">Detecting device orientation</a></dt> + <dd>Content can now detect the orientation of the device if it has a supported accelerometer, using the <a href="/en-US/docs/DOM/MozOrientation" title="en-US/docs/DOM/MozOrientation"><code>MozOrientation</code></a> event. Firefox 3.6 supports the accelerometer in Mac laptops.</dd> + <dt><a href="/en-US/docs/Monitoring_HTTP_activity" title="en-US/docs/Monitoring HTTP activity">Monitoring HTTP activity</a></dt> + <dd>You can now monitor HTTP transactions to observe requests and responses in real time.</dd> + <dt><a href="/en-US/docs/Working_with_the_Windows_taskbar" title="en-US/docs/Working with the Windows taskbar">Working with the Windows taskbar</a></dt> + <dd>It's now possible to customize the appearance of windows in the taskbar in Windows 7 or later. <em>This has been disabled by default in Firefox 3.6.</em></dd> +</dl> + +<h3 id="Places">Places</h3> + +<ul> + <li>Places queries can now use the <code>redirectsMode</code> attribute on the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsINavHistoryQueryOptions" title="">nsINavHistoryQueryOptions</a></code> interface to specify whether or not to include redirected pages in results.</li> + <li>Added the new <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIFaviconService#expireAllFavicons()">nsIFaviconService.expireAllFavicons()</a></code> method to the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFaviconService" title="">nsIFaviconService</a></code> interface.</li> +</ul> + +<h3 id="Storage">Storage</h3> + +<dl> + <dt><a href="/en-US/docs/Storage#Collation_(sorting)" title="en-US/docs/Storage#Collation (sorting)">Locale-aware collation of data is now supported by the Storage API</a></dt> + <dd>Gecko 1.9.2 added several new collation methods to provide optimized collation (sorting) of results using locale-aware techniques.</dd> + <dt><a href="/en-US/docs/mozIStorageStatementParams#Enumeration_of_properties" title="en-US/docs/mozIStorageStatementParams#Enumeration of properties">Properties on a statement can now be enumerated</a></dt> + <dd>You can now use a <code><a class="internal" href="/en-US/docs/JavaScript/Reference/Statements/for...in" title="en-US/docs/Core JavaScript 1.5 Reference/Statements/For...in">for..in</a></code> enumeration to enumerate all the properties on a statement.</dd> + <dt>mozIStorageStatement's getParameterIndex changed behavior between 3.5 and 3.6.</dt> + <dd>See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=528166" title="mozIStorageStatement getParameterIndex causes NS_ERROR_ILLEGAL_VALUE">bug 528166</a> for details.</dd> + <dt>Asynchronously bind multiple sets of parameters and execute a statement.</dt> + <dd>See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=490085" title="FIXED: Add ability to bind multiple sets of parameters and execute asynchronously">bug 490085</a> for details. Documentation coming soon.</dd> +</dl> + +<h3 id="Preferences">Preferences</h3> + +<ul> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIContentPrefService" title="">nsIContentPrefService</a></code> interface has two new methods: <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIContentPrefService#getPrefsByName()">nsIContentPrefService.getPrefsByName()</a></code> and <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIContentPrefService#removePrefsByName()">nsIContentPrefService.removePrefsByName()</a></code>.</li> +</ul> + +<h3 id="Themes">Themes</h3> + +<p>See <a class="internal" href="/en-US/docs/Updating_themes_for_Firefox_3.6" title="en-US/docs/Updating themes for Firefox 3.6">Updating themes for Firefox 3.6</a> for a list of changes related to themes.</p> + +<dl> + <dt><a href="/en-US/docs/Themes/Lightweight_themes" title="en-US/docs/Themes/Lightweight themes">Lightweight themes</a></dt> + <dd>Firefox 3.6 supports lightweight themes; these are easy-to-create themes that simply apply a background to the top (URL bar and button bar) and bottom (status bar) of browser windows. This is an integration of the existing <a class="external" href="http://www.getpersonas.com/" title="http://www.getpersonas.com/">Personas</a> theme architecture into Firefox.</dd> +</dl> + +<h3 id="Miscellaneous">Miscellaneous</h3> + +<ul> + <li>Firefox will no longer load third-party components installed in its internal components directory. This helps to ensure stability by preventing buggy third-party components from being executed. Developers that install components this way must <a href="/en-US/docs/Migrating_raw_components_to_add-ons" title="en-US/docs/Migrating raw components to add-ons">repackage their components as XPI packages</a> so they can be installed as standard add-ons.</li> + <li><code>contents.rdf</code> is no longer supported for registering chrome in extensions. You must now use the <a class="internal" href="/en-US/docs/Install_Manifests" title="en-US/docs/Install manifests"><code>chrome.manifest</code></a> file instead. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=492008" title="FIXED: Drop support for contents.rdf chrome registrations">bug 492008</a>.</li> + <li>Added support for hiding the menu bar automatically. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=477256" title="FIXED: Implement menubar auto-hiding in toolkit">bug 477256</a>.</li> + <li>Added support for the <code>container-live-role</code> attribute to objects. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=391829" title="FIXED: Add support for container-live-role to object attributes">bug 391829</a>.</li> + <li>The <code>tabs-closebutton</code> binding has been removed. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=500971" title="FIXED: Remove obsolete tabs-closebutton binding">bug 500971</a>.</li> + <li>Added support to <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISound" title="">nsISound</a></code> for playing sounds based on events that have occurred. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=502799" title="FIXED: add new nsISound method for the event sounds">bug 502799</a>.</li> + <li>The syntax for the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsITreeView" title="">nsITreeView</a></code> methods <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsITreeView#canDrop()">nsITreeView.canDrop()</a></code> and <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsITreeView#drop()">nsITreeView.drop()</a></code> has changed to support the new drag & drop API introduced in Gecko 1.9. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=455590" title="FIXED: Allow new dnd api with tree views">bug 455590</a>.</li> + <li>Added support to snap the mouse cursor to the default button of dialog or wizard on Windows, see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=76053" title='FIXED: Windows mouse integration: "Snap to default button in dialog boxes"'>bug 76053</a>. This is processed automatically by dialog and wizard element. But if a XUL application creates a window using the <code>window</code> element and it has a default button, it needs to call <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIDOMChromeWindow#notifyDefaultButtonLoaded()">nsIDOMChromeWindow.notifyDefaultButtonLoaded()</a></code> during the window's <code>onload</code> event handler.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILocalFileMac" title="">nsILocalFileMac</a></code> interface has had two methods removed: <code>setFileTypeAndCreatorFromMIMEType()</code> and <code>setFileTypeAndCreatorFromExtension()</code>.</li> + <li>The new <a class="internal" href="/en-US/docs/JavaScript_code_modules/NetUtil.jsm" title="en-US/docs/JavaScript code modules/NetUtil.jsm"><code>NetUtils.jsm</code></a> code module provides an easy-to-use method for asynchronously copying data from an input stream to an output stream.</li> + <li>The new <a class="internal" href="/en-US/docs/JavaScript_code_modules/openLocationLastURL.jsm" title="en-US/docs/JavaScript code modules/openLocationLastURL.jsm"><code>openLocationLastURL.jsm</code></a> code module makes it easy to read and change the value of the "Open Location" dialog box's remembered URL while properly taking private browsing mode into account.</li> + <li>On Windows, the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIScreen" title="">nsIScreen</a></code> interface now reports 24 bit per pixel color depths when the graphics driver claims 32 bits, since 24 more accurately represents the actual number of color pixels in use.</li> + <li>Menu bars can now be hidden on Windows, using the new <code id="a-autohide"><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Attribute/autohide">autohide</a></code> attribute on the <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/toolbar" title="toolbar">toolbar</a></code> XUL element.</li> + <li>The <span id="m-loadOneTab"><code><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Method/loadOneTab">loadOneTab</a></code></span> and <span id="m-addTab"><code><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Method/addTab">addTab</a></code></span> methods now accept a new <code>relatedToCurrent</code> parameter and, in addition, allow the parameters to be specified by name, since nearly all of the parameters are optional.</li> + <li>The "<a href="/en-US/docs/Install_Manifests#hidden" title="en-US/docs/Install Manifests#hidden">hidden</a>" property is no longer supported in install manifests; it's no longer possible to prevent the user from seeing add-ons in the add-on manager window.</li> + <li>The <code>@mozilla.org/webshell;1</code> component no longer exists; you need to use <code>@mozilla.org/docshell;1</code> instead.</li> + <li>You can now register with the update-timer category to schedule timer events without having to instantiate the object that the timer will eventually call into; it will instead be instantiated when it's needed. See <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIUpdateTimerManager#registerTimer()">nsIUpdateTimerManager.registerTimer()</a></code> for details.</li> + <li>The <a href="/en-US/docs/NPN_GetValue" title="en-US/docs/NPN GetValue"><code>NPN_GetValue()</code></a> function no longer provides access to XPCOM through the variable values <code>NPNVserviceManager</code>, <code>NPNVDOMelement</code>, and <code>NPNVDOMWindow</code>. This is part of the work toward making plugins run in separate processes in a future version of Gecko.</li> + <li>Plugins are no longer scriptable through XPCOM (IDL) interfaces, <a href="/en-US/docs/Gecko_Plugin_API_Reference/Scripting_plugins" title="en-US/docs/Gecko Plugin API Reference:Scripting plugins">NPRuntime</a> is the API to use for making plugins scriptable, and <a href="/en-US/docs/NPP_GetValue" title="en-US/docs/NPP GetValue"><code>NPP_GetValue()</code></a> is no longer called to with the value <code>NPPVpluginScriptableInstance</code> or <code>NPPVpluginScriptableIID</code>. This is part of the work toward making plugins run in separate processes in a future version of Gecko.</li> +</ul> + +<h2 id="For_FirefoxGecko_developers">For Firefox/Gecko developers</h2> + +<p>Certain changes are only really interesting if you work on the internals of Firefox itself.</p> + +<h3 id="Interfaces_merged">Interfaces merged</h3> + +<p>The following interfaces have been combined together:</p> + +<ul> + <li><code>nsIPluginTagInfo2</code> has been merged into <code>nsIPluginTagInfo</code>.</li> + <li><code>nsIPluginInstanceInternal</code>, <code>nsIPPluginInstancePeer</code>, <code>nsIPluginInstancePeer1</code>, <code>nsIPluginInstancePeer2</code>, and <code>nsIPluginInstancePeer3</code> have all been merged into <code>nsIPluginInstance</code>.</li> + <li><code>nsIWindowlessPlugInstPeer</code> has been merged into <code>nsIPluginInstance</code>.</li> + <li><code>nsIPluginManager</code> and <code>nsIPluginManager2</code> have been merged into <code>nsIPluginHost</code>.</li> +</ul> + +<h3 id="Interfaces_removed">Interfaces removed</h3> + +<p>The following interfaces have been removed entirely because they were unused, unimplemented, or obsolete:</p> + +<ul> + <li><code>nsIFullScreen</code></li> + <li><code>nsIDOMSVGListener</code></li> + <li><code>nsIDOMSVGZoomListener</code></li> + <li><code>nsIInternetConfigService</code></li> + <li><code>nsIDKey</code></li> + <li><code>nsIEventHandler</code></li> + <li><code>nsIJRILiveConnectPIPeer</code></li> + <li><code>nsIJRILiveConnectPlugin</code></li> + <li><code>nsIScriptablePlugin</code></li> + <li><code>nsIClassicPluginFactory</code></li> + <li><code>nsIFileUtilities</code></li> +</ul> + +<h3 id="Interfaces_moved">Interfaces moved</h3> + +<p>The following interfaces have been relocated from their previous IDL files into new ones:</p> + +<ul> + <li><code>nsIDOMNSCSS2Properties</code> is now located in its own IDL file (<code>dom/interfaces/css/nsIDOMCSS2Properties.idl</code>).</li> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIUpdateTimerManager" title="">nsIUpdateTimerManager</a></code> is now located in its own IDL file.</li> +</ul> + +<p>A large number of interfaces have been moved. See <a href="/en-US/docs/Interfaces_moved_in_Firefox_3.6" title="en-US/docs/Interfaces moved in Firefox 3.6">Interfaces moved in Firefox 3.6</a> for a complete list.</p> + +<h3 id="Other_interface_changes">Other interface changes</h3> + +<p>The following assorted changes have been made:</p> + +<ul> + <li>The <code>nsIPlugin</code> interface now inherits from <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISupports" title="">nsISupports</a></code> instead of <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFactory" title="">nsIFactory</a></code>.</li> + <li>The <code>nsIPluginHost</code> interface now inherits from <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISupports" title="">nsISupports</a></code> instead of <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFactory" title="">nsIFactory</a></code>.</li> + <li>The <code>nsIFrame</code> interface now inherits from <code>nsQueryFrame</code> instead of <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISupports" title="">nsISupports</a></code>.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDeviceContext" title="">nsIDeviceContext</a></code> method <code>getPaletteInfo()</code> has been removed, as it was never implemented.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIScriptContext" title="">nsIScriptContext</a></code> method <code>reportPendingException()</code> has been removed, since it was no longer being used.</li> +</ul> + +<h3 id="Changes_in_accessibility_code">Changes in accessibility code</h3> + +<ul> + <li>The <span style="font-family: monospace;">EVENT</span><code>_REORDER</code> <a href="/en-US/docs/XPCOM_Interface_Reference/nsIAccessibleEvent" title="en-US/docs/XPCOM Interface Reference/nsIAccessibleEvent">accessibility event</a> is now sent when the children of frames and iframes change, as well as when the main document's children change. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420845" title="FIXED: Fire event_reorder on any embedded frames/iframes whos document has just loaded.">bug 420845</a>.</li> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIAccessibleTable#selectRow()">nsIAccessibleTable.selectRow()</a></code> now correctly removes any current selection before selecting the specified row.</li> +</ul> + +<h2 id="See_also">See also</h2> + +<div><div class="multiColumnList"> +<ul> +<li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.5">Firefox 3.5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3">Firefox 3 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/2">Firefox 2 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/1.5">Firefox 1.5 for developers</a></li></ul> +</div></div> diff --git a/files/zh-tw/mozilla/firefox/releases/3/dom_improvements/index.html b/files/zh-tw/mozilla/firefox/releases/3/dom_improvements/index.html new file mode 100644 index 0000000000..315cc39037 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/3/dom_improvements/index.html @@ -0,0 +1,26 @@ +--- +title: Firefox 3 Dom Improvements +slug: Mozilla/Firefox/Releases/3/DOM_improvements +translation_of: Mozilla/Firefox/Releases/3/DOM_improvements +--- +<div>{{FirefoxSidebar}}</div><h3 id="Firefox_3_.E5.B0.8D_DOM_.E7.9A.84.E6.94.B9.E5.96.84" name="Firefox_3_.E5.B0.8D_DOM_.E7.9A.84.E6.94.B9.E5.96.84">Firefox 3 對 DOM 的改善</h3> +<p>Firefox 3 對 DOM 做了一些改善,改善重點之一就是加強對於「其他瀏覽器對 DOM 所增加的延伸規格」的支援。</p> +<ul> + <li>支援 IE 的延伸規格 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:element.clientTop">clientTop</a> 與 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:element.clientLeft">clientLeft</a>。</li> + <li>現在不論在哪裡讀取,<a class="external" href="http://developer.mozilla.org/en/docs/DOM:window.fullScreen">wondow.fullScreen</a> perperty 可以總是保持正確,即使在 content 內也一樣。先前會錯誤地回報 false (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=127013">Bug127013</a>) 。</li> + <li>支援 IE 的延伸規格 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:element.getClientRects">getClientRects</a> and <a class="external" href="http://developer.mozilla.org/en/docs/DOM:element.getBoundingClientRect">getBoundingClientRect</a> (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=174397">Bug 174397</a>).</li> + <li>支援 IE 的延伸規格 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:document.elementFromPoint">elementFromPoint</a> (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=199692">Bug 199692</a>)</li> + <li>支援 IE 的延伸規格 oncut, oncopy, onpaste, onbeforecut, onbeforecopy and onbeforepaste (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=280959">Bug 280959</a>)</li> + <li>新增可以用於 Node.nodePrincipal, Node.baseURIObject, and <a class="external" href="http://developer.mozilla.org/en/docs/DOM:document.documentURIObject">document.documentURIObject</a> 的 privileged-code-only getters。Chrome code 絕對不可以在 unwrapped content object (例如: 在 <a class="external" href="http://developer.mozilla.org/en/docs/XPCNativeWrapper">XPCNativeWrapper</a> 的 wrappedJSObject) 上 touch (get or set) 這些 properties,詳見 <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=324464">Bug 324464</a>。</li> + <li>支援 The Web Applications 1.0 (HTML5) 的 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:document.getElementsByClassName">getElementsByClassName()</a></li> +</ul> +<h3 id=".E5.8F.83.E8.80.83.E8.B3.87.E6.96.99" name=".E5.8F.83.E8.80.83.E8.B3.87.E6.96.99">參考資料</h3> +<ul> + <li><a class="external" href="http://developer.mozilla.org/en/docs/DOM_improvements_in_Firefox_3">DOM Improvements in Firefox 3 原始網頁</a></li> +</ul> +<h3 id=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80" name=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80">延伸閱讀</h3> +<ul> + <li><a class="external" href="http://developer.mozilla.org/zh_tw/docs/Firefox_3_for_developers">Firefox 3 開發人員須知</a></li> + <li><a class="external" href="http://developer.mozilla.org/zh_tw/docs/Firefox_3_CSS_Improvement">Firefox 3 對 CSS 的改善</a></li> + <li><a class="external" href="http://developer.mozilla.org/en/docs/DOM">DOM</a></li> +</ul> diff --git a/files/zh-tw/mozilla/firefox/releases/3/firefox_3_css_improvement/index.html b/files/zh-tw/mozilla/firefox/releases/3/firefox_3_css_improvement/index.html new file mode 100644 index 0000000000..bbad0696a8 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/3/firefox_3_css_improvement/index.html @@ -0,0 +1,30 @@ +--- +title: Firefox 3 CSS Improvement +slug: Mozilla/Firefox/Releases/3/Firefox_3_CSS_Improvement +translation_of: Mozilla/Firefox/releases/3/CSS_improvements +--- +<div>{{FirefoxSidebar}}</div><h3 id="Firefox_3_CSS_.E7.9A.84.E6.94.B9.E5.96.84" name="Firefox_3_CSS_.E7.9A.84.E6.94.B9.E5.96.84">Firefox 3 CSS 的改善</h3> +<ul> + <li>實做了 <a class="external" href="http://www.w3.org/TR/CSS21/visuren.html#propdef-display">display</a> property 的兩個特性值 <a class="external" href="http://www.w3.org/TR/CSS21/visuren.html#value-def-inline-block">inline-block</a> 與 <a class="external" href="http://www.w3.org/TR/CSS21/tables.html#value-def-inline-table">inline-table</a>。</li> + <li>現在所有平台都支援 <a class="external" href="http://www.w3schools.com/css/pr_font_font-size-adjust.asp">font-size-adjust</a> property (先前只在 Windows 平台支援)。</li> + <li>支援 <a class="external" href="http://www.w3.org/TR/css3-color/">CSS 3 Color Module</a> 中加入的特性值 <a class="external" href="http://www.w3.org/TR/css3-color/#rgba-color">rgba()</a> 與 <a class="external" href="http://www.w3.org/TR/css3-color/#hsla-color">hsla()</a> (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=147017">Bug 147017</a>)。</li> + <li>支援 <a class="external" href="http://www.w3.org/TR/css3-ui/">CSS3 Basic User Interface Module</a> 的 pesudo-class <a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-default">:default</a> (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=302186">Bug 302186</a>)。</li> + <li>替 width, min-width, max-width 這三個 properties 加入四個特性值: -moz-max-content, -moz-min-content, -moz-fit-content, 與 -moz-available (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=311415">Bug 311415</a> 與 <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402706">Bug 402706</a>)。</li> + <li>支援 HTML soft hyphens (&shy;)。</li> + <li>現在 Pre-formatted tabs 在使用比例字型時的表現好多了,遵守 CSS 2.1 規格書。</li> + <li>支援微軟的 CSS 規格 <a class="external" href="http://developer.mozilla.org/en/docs/CSS:ime-mode">ime-mode </a> property。</li> + <li>現在支援了 CSS text-rendering property for HTML (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=387969">Bug 387969</a>)。</li> + <li>實做了兩個 CSS properties: -moz-border-*-start 與 -moz-border-*-end (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=74880">Bug 74880</a>)。</li> + <li>現在 -moz-initial 幾乎實做於所有的 CSS properties 了 (除了 quotes and -moz-border-*-colors) (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=80887">Bug 80887</a>)。</li> + <li>window.getComputedStyle() 現在支援所有已支援的 CSS properties (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=316981">Bug 316981</a>).</li> + <li>支援 content property 的特性值 "none" (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=378535">Bug 378535</a>)。</li> + <li>支援 cursor property 的特性值 "none" (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=378535">Bug 378535</a>)。</li> +</ul> +<h3 id=".E5.8F.83.E8.80.83.E8.B3.87.E8.A8.8A" name=".E5.8F.83.E8.80.83.E8.B3.87.E8.A8.8A">參考資訊</h3> +<ul> + <li><a class="external" href="http://developer.mozilla.org/en/docs/CSS_improvements_in_Firefox_3">CSS improvements in Firefox 3 原始網頁</a></li> +</ul> +<h3 id=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80" name=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80">延伸閱讀</h3> +<ul> + <li><a class="external" href="http://msdn2.microsoft.com/en-us/library/ms533883.aspx">ime-mode Attribute | imeMode Property</a></li> +</ul> diff --git a/files/zh-tw/mozilla/firefox/releases/3/index.html b/files/zh-tw/mozilla/firefox/releases/3/index.html new file mode 100644 index 0000000000..a6663801f8 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/3/index.html @@ -0,0 +1,93 @@ +--- +title: Firefox 3 技術文件 +slug: Mozilla/Firefox/Releases/3 +translation_of: Mozilla/Firefox/Releases/3 +--- +<div>{{FirefoxSidebar}}</div><h3 id="Firefox_3_.E7.B6.B2.E7.AB.99.E9.96.8B.E7.99.BC.E9.A0.88.E7.9F.A5" name="Firefox_3_.E7.B6.B2.E7.AB.99.E9.96.8B.E7.99.BC.E9.A0.88.E7.9F.A5">Firefox 3 網站開發須知</h3> +<p> </p> +<dl> + <dt> + Web application 需要更新的地方</dt> + <dd> + 提供一些應用 Firefox 3 的新功能在 web applications 時可能需要注意的地方。</dd> + <dt> + <a href="zh_tw/Firefox_3_Online_and_Offline_Events">Online / Offline 事件</a></dt> + <dd> + Firefox 3 支援 <a class="external" href="http://wiki.whatwg.org/wiki/FAQ#What_is_the_WHATWG.3F">WHATWG</a> 的 online/offline event,讓 applications/extensions 可以偵測目前是否有 active 的網際網路連線、目前是在線上還是斷線中。</dd> + <dt> + <a href="zh_tw/Firefox_3_supports_Cross-site_XMLHttpRequest">Cross-site XMLHttpRequest</a></dt> + <dd> + Firefox 3 支援了 <a class="external" href="http://www.w3.org/TR/access-control/">W3C Access Control</a> working draft,這讓你可以對其他網站作 XMLHttpRequests 以取得其他網站的資料,並加以管理,這讓你可以在自己建立的網站中,混入來自多個其他網站的內容。</dd> + <dt> + Alternate style sheet</dt> + <dd> + Firefox 3 支援 CSS object model alternate style sheet API。(見 <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=200930">Bug 200930</a>)</dd> + <dt> + <a href="zh_tw/Firefox_3_Web-based_protocol_handler">Web-based protocol handlers</a></dt> + <dd> + 在 Firefox 3,我們可以使用 navigator.registerProtocolHandler() 的方式把 web application 註冊為 protocal handler。</dd> + <dt> + 使用 Canvas 來「畫」字</dt> + <dd> + Firefox 3 支援用 mozilla 專用的非標準、實驗中的 API (mozXXX) 來處理 <canvas></dd> + <dt> + 支援在 Canvas 使用 transform</dt> + <dd> + Firefox 3 支援在 <canvas> 上使用 transform() 與 setTransform()</dd> + <dt> + <a href="zh_tw/Firefox_3_Using_Microformat">使用 microformat</a></dt> + <dd> + Firefox 3 現在有 APIs 可以處理 microformat</dd> + <dt> + <a href="zh_tw/Firefox_3_Drag_and_Drop_Events">Drag / drop</a> 事件</dt> + <dd> + Firefox 3 支援兩個新的 events,在「拖放」開始與結束的時候,可以傳給「拖放操作」的 source node。</dd> + <dt> + HTML 5 的 focus 相關屬性</dt> + <dd> + Firefox 3 支援 HTML 5 新增給 DOM 的兩個屬性 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:document.activeElement">activeElement</a> 與 <a class="external" href="http://developer.mozilla.org/en/docs/DOM:document.hasFocus">hasFocus</a>。</dd> + <dt> + <a href="zh_tw/Offline_resources_on_Firefox">Offline resources on Firefox</a></dt> + <dd> + Firefox 3 現在支援讓 web application 可以要求將 resources 存入快取,以便我們離線時可以執行 web applications。</dd> + <dt> + <a href="zh_tw/Firefox_3_CSS_Improvement">CSS 的改善</a></dt> + <dd> + Firefox 3 改善了對於 CSS 的支援。</dd> + <dt> + <a href="zh_tw/Firefox_3_Dom_Improvements">DOM 的改善</a></dt> + <dd> + Firefox 3 的 DOM implimentation 有一些新功能,其中包括:支援了 IE 對 DOM 作的某些 extensions。</dd> + <dt> + Javascript 1.8 的支援</dt> + <dd> + Firefox 3 現在支援 Javascript 1.8。(見 <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=380236">Bug 380236</a>)</dd> + <dt> + EXSLT 的支援</dt> + <dd> + Firefox 3 支援了 a substantial subset of the EXSLT extensions to XSLT。</dd> + <dt> + SVG 的改善</dt> + <dd> + Firefox 3 大大提高了對 SVG 的支援,其中包括:支援了超過兩打的新 filters、好幾個新元素、新屬性,以及其他的改善。</dd> + <dt> + <a href="zh_tw/Firefox_3_Animated_PNG_support">Animated PNG</a> 的支援</dt> + <dd> + Firefox 3 現在支援動態 PNG 格式 (Animated PNG image format)</dd> + <dt> + <a href="zh_tw/Firefox_3_ping_attribute_support_for_anchor_element"><a ping></a> 的支援</dt> + <dd> + Firefox 3 現在支援用 <a ping> 去 ping URL,並且預設是 enable 的。</dd> +</dl> +<h3 id=".E5.8F.83.E8.80.83.E8.B3.87.E6.96.99" name=".E5.8F.83.E8.80.83.E8.B3.87.E6.96.99">參考資料</h3> +<p><a class="external" href="http://developer.mozilla.org/en/docs/Firefox_3_for_developers#For_web_site_and_application_developers">Firefox 3 for developers</a></p> +<h3 id=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80" name=".E5.BB.B6.E4.BC.B8.E9.96.B1.E8.AE.80">延伸閱讀</h3> +<ul> + <li><a class="external" href="http://developer.mozilla.org/en/docs/Updating_extensions_for_Firefox_3">Updating extensions for Firefox 3</a></li> + <li><a class="external" href="http://developer.mozilla.org/en/docs/Updating_web_applications_for_Firefox_3">Updating web applications for Firefox 3</a></li> + <li><a class="external" href="http://developer.mozilla.org/en/docs/Firefox_2_for_developers">Firefox 2 for developers</a></li> + <li><a class="external" href="http://developer.mozilla.org/en/docs/Firefox_1.5_for_developers">Firefox 1.5 for developers</a></li> +</ul> +<div class="noinclude"> + </div> +<p>{{ languages( { "en": "en/Firefox_3_for_developers", "es": "es/Firefox_3_para_desarrolladores", "fr": "fr/Firefox_3_pour_les_d\u00e9veloppeurs", "ja": "ja/Firefox_3_for_developers", "ko": "ko/Firefox_3_for_developers", "pl": "pl/Firefox_3_dla_programist\u00f3w", "pt": "pt/Firefox_3_para_desenvolvedores" } ) }}</p> diff --git a/files/zh-tw/mozilla/firefox/releases/35/index.html b/files/zh-tw/mozilla/firefox/releases/35/index.html new file mode 100644 index 0000000000..d15394097d --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/35/index.html @@ -0,0 +1,130 @@ +--- +title: Firefox 35 技術文件 +slug: Mozilla/Firefox/Releases/35 +translation_of: Mozilla/Firefox/Releases/35 +--- +<div><section class="Quick_links" id="Quick_Links"> + <ol> + <li class="toggle"> + <details> + <summary>Firefox developer release notes</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Releases">Firefox developer release notes</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>擴充套件</summary> + <ol> + <li><a href="/zh-TW/Add-ons/WebExtensions">瀏覽器擴充功能</a></li> + <li><a href="/zh-TW/Add-ons/Themes">主題</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Firefox internals</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/">Mozilla project</a></li> + <li><a href="/zh-TW/docs/Mozilla/Gecko">Gecko</a></li> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Headless_mode">Headless mode</a></li> + <li><a href="/zh-TW/docs/Mozilla/JavaScript_code_modules">JavaScript 程式碼模組</a></li> + <li><a href="/zh-TW/docs/Mozilla/js-ctypes">JS-ctypes</a></li> + <li><a href="/zh-TW/docs/Mozilla/MathML_Project">MathML 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/MFBT">MFBT</a></li> + <li><a href="/zh-TW/docs/Mozilla/Projects">Mozilla 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/Preferences">Preference system</a></li> + <li><a href="/zh-TW/docs/Mozilla/WebIDL_bindings">WebIDL bindings</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XPCOM">XPCOM</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XUL">XUL</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Building and contributing</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions">建置教學</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options">Configuring build options</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/How_Mozilla_s_build_system_works">How the build system works</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Source_Code/Mercurial">Mozilla 原始碼</a></li> + <li><a href="/zh-TW/docs/Mozilla/Localization">在地化</a></li> + <li><a href="/zh-TW/docs/Mozilla/Mercurial">Mercurial</a></li> + <li><a href="/zh-TW/docs/Mozilla/QA">Quality assurance</a></li> + <li><a href="/zh-TW/docs/Mozilla/Using_Mozilla_code_in_other_projects">在我們的專案中使用 Mozilla 程式碼</a></li> + </ol> + </details> + </li> + </ol> +</section></div><div> + {{ ReleaseChannelInfo("35", "35", "January 2015", "Aurora") }}</div> +<p>Want to help document Firefox 35? See the <a class="external" href="http://beta.elchi3.de/doctracker/#list=fx&version=35.0">list of bugs that need to be written about</a> and pitch in!</p> +<h2 id="Changes_for_Web_developers">Changes for Web developers</h2> +<h3 id="Developer_Tools">Developer Tools</h3> +<p>Highlights:</p> +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector#.3A.3Abefore_and_.3A.3Aafter">See ::before and ::after pseudo elements in the Page Inspector</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Tools/Style_Editor#Source_map_support">CSS source maps are now enabled by default</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector#Element_popup_menu_2">"Show DOM Properties" from the Page Inspector</a></li> +</ul> +<p><a class="external-icon external" href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&chfieldto=2014-10-13&chfield=resolution&query_format=advanced&chfieldfrom=2014-09-02&chfieldvalue=FIXED&component=Developer%20Tools&component=Developer%20Tools%3A%203D%20View&component=Developer%20Tools%3A%20Canvas%20Debugger&component=Developer%20Tools%3A%20Console&component=Developer%20Tools%3A%20Debugger&component=Developer%20Tools%3A%20Framework&component=Developer%20Tools%3A%20Graphic%20Commandline%20and%20Toolbar&component=Developer%20Tools%3A%20Inspector&component=Developer%20Tools%3A%20Memory&component=Developer%20Tools%3A%20Netmonitor&component=Developer%20Tools%3A%20Object%20Inspector&component=Developer%20Tools%3A%20Profiler&component=Developer%20Tools%3A%20Responsive%20Mode&component=Developer%20Tools%3A%20Scratchpad&component=Developer%20Tools%3A%20Source%20Editor&component=Developer%20Tools%3A%20Storage%20Inspector&component=Developer%20Tools%3A%20Style%20Editor&component=Developer%20Tools%3A%20Timeline&component=Developer%20Tools%3A%20User%20Stories&component=Developer%20Tools%3A%20Web%20Audio%20Editor&component=Developer%20Tools%3A%20WebGL%20Shader%20Editor&component=Developer%20Tools%3A%20WebIDE&component=Simulator&product=Firefox&product=Firefox%20OS&list_id=11184176">All devtools bugs fixed between Firefox 34 and Firefox 35</a>.</p> +<h3 id="CSS">CSS</h3> +<ul> + <li>The <a href="/zh-TW/docs/Web/CSS/mask-type" title="The documentation about this has not yet been written; please consider contributing!"><code>mask-type</code></a> property has been activated by default (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1058519" title="FIXED: Ship mask-type CSS property">bug 1058519</a>).</li> + <li>The <a href="/zh-TW/docs/Web/CSS/filter" title="The documentation about this has not yet been written; please consider contributing!"><code>filter</code></a> property is now activated by default (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1057180" title="FIXED: Turn on CSS Filters by default (by enabling about:config pref)">bug 1057180</a>).</li> + <li>The <a href="/zh-TW/docs/Web/CSS/@font-face" title="The @font-face CSS at-rule allows authors to specify online fonts to display text on their web pages. By allowing authors to provide their own fonts, @font-face eliminates the need to depend on the limited number of fonts users have installed on their computers. The @font-face at-rule may be used not only at the top level of a CSS, but also inside any CSS conditional-group at-rule."><code>@font-face</code></a> at-rule now supports WOFF2 fonts (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1064737" title="FIXED: support WOFF2 fonts via @font-face">bug 1064737</a>).</li> +</ul> +<h3 id="HTML">HTML</h3> +<ul> + <li>The obsolete and non-conforming <code>bottommargin</code>, <code>leftmargin</code>, <code>rightmargin</code> and <code>topmargin</code> attributes of the <code><a href="/zh-TW/docs/Web/HTML/Element/body" title="The documentation about this has not yet been written; please consider contributing!"><code><body></code></a> element</code> have been activated in non-quirks mode (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=95530" title="FIXED: topmargin and leftmargin attributes on the BODY element should be honored in all modes (not just Quirks mode)">bug 95530</a>).</li> +</ul> +<h3 id="JavaScript">JavaScript</h3> +<ul> + <li>The "<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone_and_errors_with_let">temporal dead zone</a>" for <a href="/en-US/docs/Web/JavaScript/Reference/Statements/let"><code>let</code></a> declarations has been implemented. In conformance with ES6 <code>let</code> semantics, the following situations<br> + now throw errors. See also this<a href="https://groups.google.com/forum/#!topic/mozilla.dev.platform/tezdW299Zds"> newsgroup announcement</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1001090" title='FIXED: Implement ES6 "temporal dead zone" for let'>bug 1001090</a>. + <ul> + <li>Redeclaring existing variables or arguments using <code>let</code> within the same scope in function bodies is now a syntax error.</li> + <li>Using a variable declared using <code>let</code> in function bodies before the declaration is reached and evaluated is now a runtime error.</li> + </ul> + </li> + <li>ES6 <a href="/zh-TW/docs/Web/JavaScript/Reference/Symbols" title="The documentation about this has not yet been written; please consider contributing!"><code>Symbols</code></a> (only available in the Nightly channel) have been updated to conform with recent specification changes: + <ul> + <li><code>String(Symbol("1"))</code> now no longer throws a <a href="/zh-TW/docs/Web/JavaScript/Reference/TypeError" title="The documentation about this has not yet been written; please consider contributing!"><code>TypeError</code></a>; instead a string (<code>"Symbol(1)"</code>) gets returned (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1058396" title="FIXED: String(aSymbol) now returns the symbol’s description in ES6 draft rev 27">bug 1058396</a>).</li> + </ul> + </li> + <li>The various <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#TypedArray_objects"><em>TypedArray</em> constructors</a> now have as their <code>[[Prototype]]</code> a single function, denoted <code>%TypedArray%</code> in ES6 (but otherwise not directly exposed). Each typed array prototype now inherits from <code>%TypedArray%.prototype</code>. (<code>%TypedArray%</code> and <code>%TypedArray%.prototype</code> inherit from <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/prototype"><code>Function.prototype</code></a> and <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype"><code>Object.prototype</code></a>, respectively, so that typed array constructors and instances still have the properties found on those objects.) Typed array function properties now reside on <code>%TypedArray%.prototype</code> and work on any typed array. See <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Description"><em>TypedArray</em></a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=896116" title="FIXED: Implement ES6 %TypedArray% superclass that all ArrayBufferViews inherit from">bug 896116</a> for more information.</li> + <li>ES6 semantics for <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Prototype_mutation">prototype mutations using object literals</a> have been implemented (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1061853" title="FIXED: Implement ES6 object-literal __proto__ restrictions/semantics">bug 1061853</a>). + <ul> + <li>Now only a single member notated as <code>__proto__:value</code> will mutate the <code>[[Prototype]]</code> in the object literal syntax.</li> + <li>Method members like <code>__proto__() {}</code> will not overwrite the <code>[[Prototype]]</code> anymore.</li> + </ul> + </li> +</ul> +<h3 id="InterfacesAPIsDOM">Interfaces/APIs/DOM</h3> +<ul> + <li>The <a href="/zh-TW/docs/Web/API/NavigatorLanguage" title="The documentation about this has not yet been written; please consider contributing!"><code>NavigatorLanguage</code></a> interface is now available to workers on <a href="/zh-TW/docs/Web/API/WorkerNavigator" title="The documentation about this has not yet been written; please consider contributing!"><code>WorkerNavigator</code></a> (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=925849" title="FIXED: WorkerNavigator does not implement NavigatorLanguage">bug 925849</a>).</li> + <li>The <a href="/zh-TW/docs/Web/API/Element/closest" title="The documentation about this has not yet been written; please consider contributing!"><code>Element.closest</code></a> method returns the closest ancestor of the current element (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1055533" title="FIXED: Implement Element.closest()">bug 1055533</a>).</li> +</ul> +<h3 id="MathML">MathML</h3> +<ul> + <li>The <code>dtls</code> OpenType feature (via the CSS <a href="/zh-TW/docs/Web/CSS/font-feature-settings" title="The documentation about this has not yet been written; please consider contributing!"><code>font-feature-settings</code></a> on the default stylesheet) is now applied automatically to MathML elements when positioning scripts over it (e.g. dotless i with mathematical hat).</li> +</ul> +<h3 id="SVG">SVG</h3> +<p><em>No change.</em></p> +<h3 id="AudioVideo">Audio/Video</h3> +<p><em>No change.</em></p> +<h2 id="Security">Security</h2> +<ul> + <li>The <a href="/en-US/docs/Web/Security/Public_Key_Pinning">Public Key Pinning</a> Extension for HTTP (HPKP) has been implemented. (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=787133" title="FIXED: Implement Public Key Pinning Extension for HTTP (HPKP)">bug 787133</a>)</li> +</ul> +<h2 id="Changes_for_add-on_and_Mozilla_developers">Changes for add-on and Mozilla developers</h2> +<h3 id="XUL">XUL</h3> +<ul> + <li>The private <code>_getTabForBrowser()</code> method on the <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/tabbrowser" title="tabbrowser">tabbrowser</a></code> element has been deprecated. In its place, we've added a new, public, method called <span id="m-getTabForBrowser"><code><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Method/getTabForBrowser">getTabForBrowser</a></code></span>. This returns, predictably, the <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/tab" title="tab">tab</a></code> element that contains the specified <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/browser" title="browser">browser</a></code>.</li> +</ul> +<h2 id="Older_versions">Older versions</h2> +<div class="multiColumnList"> +<ul> +<li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/34">Firefox 34 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/33">Firefox 33 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/32">Firefox 32 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/31">Firefox 31 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/30">Firefox 30 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/29">Firefox 29 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/28">Firefox 28 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/27">Firefox 27 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/26">Firefox 26 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/25">Firefox 25 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/24">Firefox 24 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/23">Firefox 23 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/22">Firefox 22 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/21">Firefox 21 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/20">Firefox 20 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/19">Firefox 19 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/18">Firefox 18 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/17">Firefox 17 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/16">Firefox 16 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/15">Firefox 15 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/14">Firefox 14 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/13">Firefox 13 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/12">Firefox 12 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/11">Firefox 11 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/10">Firefox 10 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/9">Firefox 9 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/8">Firefox 8 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/7">Firefox 7 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/6">Firefox 6 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/5">Firefox 5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/4">Firefox 4 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.6">Firefox 3.6 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.5">Firefox 3.5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3">Firefox 3 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/2">Firefox 2 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/1.5">Firefox 1.5 for developers</a></li></ul> +</div> diff --git a/files/zh-tw/mozilla/firefox/releases/4/firefox_4_開發者新功能概覽/index.html b/files/zh-tw/mozilla/firefox/releases/4/firefox_4_開發者新功能概覽/index.html new file mode 100644 index 0000000000..c36dad8487 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/4/firefox_4_開發者新功能概覽/index.html @@ -0,0 +1,228 @@ +--- +title: Firefox 4 for developers +slug: Mozilla/Firefox/Releases/4/Firefox_4_開發者新功能概覽 +--- +<div>{{FirefoxSidebar}}</div><p>2010 年六月起進入 Beta 測試期的 Firefox 4,增進了效能、加強針對 HTML 5 及其他創新網際科技的支援程度,也更加安全。本文為網頁、附加元件、Gecko 平台開發者們提供這一版的簡要技術相關資訊。</p> + +<div class="geckoVersionNote"> +<p>{{ gecko_callout_heading("2") }}</p> + +<p>Gecko 1.9.3 即將更名為 Gecko 2,但許多文件還沒有針對此點更新,在接下來的幾個星期中才會有所更動。</p> +</div> + +<p>以下大部分的功能都已經可以在 <a class="external" href="http://nightly.mozilla.org/" title="http://nightly.mozilla.org/">逐日建置版</a>中試用。</p> + +<div class="note"><strong>註:</strong>本文、以及本文所連結的其他文件仍持續編修中,很多文件的名稱只是暫定、有些主題的文件也可能會拆成幾份子文件以方便閱讀。中文團隊的目標將僅翻譯這份概覽,其他子文件則有待大家的幫忙。</div> + +<h2 id="Features_for_web_developers">Features for web developers</h2> + +<p>Gecko now uses the <a href="/en/HTML/HTML5" title="en/HTML/HTML5">HTML5</a> parser, which fixes bugs, improves interoperability, and improves performance. It also lets content embed <a href="/en/SVG" title="en/SVG">SVG</a> and <a href="/en/MathML" title="en/MathML">MathML</a> directly in the HTML markup.</p> + +<h3 id="HTML">HTML</h3> + +<dl> + <dt>Introduction to the HTML5 parser</dt> + <dd>A look at what the HTML5 parser means to you, and how to embed SVG and MathML into your content inline.</dd> + <dt><a href="/en/HTML/HTML5/Forms_in_HTML5" title="en/HTML/Forms in HTML5">Forms in HTML5</a></dt> + <dd>A look at improvements to web forms in HTML5.</dd> + <dt><a href="/en/Sections_and_Outlines_of_an_HTML5_document" title="en/Sections and Outlines of an HTML5 document">HTML5 Sections</a></dt> + <dd>Gecko now supports the new HTML5 elements related to sections in a document: {{ HTMLElement("article") }}, {{ HTMLElement("section") }}, {{ HTMLElement("nav") }}, {{ HTMLElement("aside") }}, {{ HTMLElement("hgroup") }}, {{ HTMLElement("header") }} and {{ HTMLElement("footer") }}.</dd> + <dt>Other HTML5 elements</dt> + <dd>Gecko now also supports the following new HTML5 elements: {{ HTMLElement("mark") }}, {{ HTMLElement("figure") }} and {{ HTMLElement("figcaption") }}.</dd> + <dt>WebSockets</dt> + <dd>A guide to using the new WebSockets API for real-time communication between a web application and a server.</dd> +</dl> + +<h4 id="Miscellaneous_HTML_changes">Miscellaneous HTML changes</h4> + +<ul> + <li>{{ HTMLElement("textarea") }} elements are now resizable by default; you can use the {{ cssxref("resize") }} CSS property to disable this.</li> + <li><code>canvas.getContext</code> and <code>canvas.toDataURL</code> no longer throw an exception when called with unrecognized arguments.</li> + <li><code>canvas2dcontext.globalCompositeOperation</code>, <code>canvas2dcontext.lineCap</code> and <code>canvas2dcontext.lineJoin</code> no longer throw an exception when set to an unrecognized value.</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<dl> + <dt><a href="/en/CSS/CSS_transitions" title="en/CSS/CSS transitions">CSS transitions</a></dt> + <dd>New CSS transitions support is available in Firefox 4.</dd> + <dt>Computed values in CSS</dt> + <dd>Support for<code> calc() </code>to compute values in CSS is in progress. See {{ bug(363249) }}.</dd> + <dt>Selector grouping</dt> + <dd>Support for {{ cssxref(":-moz-any") }} to group selectors and factorize combinators.</dd> + <dt>Background image subrectangle support</dt> + <dd>The {{ cssxref("-moz-image-rect") }} property makes it possible to use subrectangles of images as a background image.</dd> + <dt>CSS touch properties</dt> + <dd>Support for touch properties is added. Details, and real article names, to come later.</dd> + <dt><a href="/en/CSS/Privacy_and_the_:visited_selector" title="en/CSS/Privacy and the :visited selector">Privacy and the :visited selector</a></dt> + <dd>Changes have been made to what information can be obtained about the style of visited links using CSS selectors. This may affect some web applications.</dd> +</dl> + +<h4 id="Miscellaneous_CSS_changes">Miscellaneous CSS changes</h4> + +<ul> + <li>The {{ cssxref("text-shadow") }} property now caps the blur radius to 300px for sanity and performance reasons.</li> + <li>The {{ cssxref(":-moz-window-inactive") }} pseudoclass has been implemented.</li> + <li>The {{ cssxref("-moz-tab-size") }} property lets you specify the width in space characters of a tab character (U+0009) when rendering text.</li> + <li>The CSS3 {{ cssxref("resize") }} property has been implemented.</li> + <li>The<code> -moz-background-size </code>property has been renamed to its final {{ cssxref("background-size") }} naming; <code>-moz-background-size</code> is no longer supported.</li> + <li>The {{ cssxref("oveflow") }} property no longer applies to table-group elements ({{ HTMLElement("thead") }}, {{ HTMLElement("tbody") }}, and {{ HTMLElement("tfoot") }}).</li> +</ul> + +<h3 id="Graphics_and_video">Graphics and video</h3> + +<dl> + <dt> </dt> + <dt><a href="/en/WebGL" title="en/WebGL">WebGL</a></dt> + <dd>The developing WebGL standard is now supported by Firefox.</dd> + <dt>Optimizing graphics performance</dt> + <dd>Tips and tricks for getting the most out of graphics and video performance in Firefox 4.</dd> + <dt><a href="/En/Media_formats_supported_by_the_audio_and_video_elements#WebM" title="En/Media formats supported by the audio and video elements#WebM">Support for WebM video</a></dt> + <dd>The new open <a class="external" href="http://www.webmproject.org/" title="http://www.webmproject.org/">WebM</a> video format is supported by Gecko 1.9.3; support is included in nightlies as of 9 June.</dd> + <dt>Full screen API</dt> + <dd>Details coming soon.</dd> + <dt>SMIL animation</dt> + <dd>Support for SMIL animation of SVG is now available. See {{ bug(482402) }}.</dd> + <dt>Using SVG as images and as CSS backgrounds</dt> + <dd>You can now use SVG with the {{ htmlelement("img") }} element, as well as the background image in CSS. See {{ bug(272288) }}, {{ bug(276431) }} and {{ bug(231179) }}.</dd> +</dl> + +<h3 id="DOM">DOM</h3> + +<dl> + <dt>Obtaining boundary rectangles for ranges</dt> + <dd>The Range object now has <code>getClientRects()</code> and <code>getBoundingClientRect()</code> methods. See {{ bug(396392) }}.</dd> + <dt>Capturing mouse events on arbitrary elements</dt> + <dd>Support for the Internet Explorer-originated <code>setCapture()</code> and <code>releaseCapture()</code> APIs has been added. See {{ bug(503943) }}.</dd> + <dt><a href="/en/DOM/Manipulating_the_browser_history" title="en/DOM/Manipulating the browser history">Manipulating the browser history</a></dt> + <dd>The existing document history object, available through the {{ domxref("window.history") }} object, now supports the new HTML5 <code>pushState()</code> and <code>replaceState()</code> methods.</dd> + <dt>Touch and multi-touch events</dt> + <dd>Support has been added for touch and multi-touch events.</dd> + <dt><a href="/en/IndexedDB" title="IndexedDB">IndexedDB</a></dt> + <dd>The proposed IndexedDB standard, which provides a local database store for web applications, will be supported by Firefox 4.</dd> +</dl> + +<h4 id="Miscellaneous_DOM_changes">Miscellaneous DOM changes</h4> + +<ul> + <li>The wrapping of a {{ HTMLElement("textarea") }} element can now be controlled via the DOM, via the <code>wrap</code> DOM attribute. {{ bug(41464) }}</li> + <li>DOM {{ domxref("file") }} objects now offer a <code>url</code> property.</li> + <li>DOM {{ domxref("file") }} objects now have a new <code>click()</code> method. (Note: not done yet, see <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=36619" title="https://bugzilla.mozilla.org/show_bug.cgi?id=36619">bug 36619</a>.)</li> + <li><a href="/En/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects" title="en/XMLHttpRequest/Using XMLHttpRequest#Using FormData objects">FormData</a> support for XMLHttpRequest.</li> + <li>The {{ domxref("element.isContentEditable") }} property has been implemented.</li> + <li>Added the <a href="/En/DragDrop/DataTransfer#mozSourceNode" title="En/DragDrop/DataTransfer#mozSourceNode"><code>mozSourceNode</code></a> property to the <a href="/En/DragDrop/DataTransfer" title="En/DragDrop/DataTransfer"><code>DragTransfer</code></a> object.</li> + <li>Added the <a href="/en/DOM/Selection/modify" title="en/DOM/selection/modify"><code>selection.modify()</code></a> method to the {{ domxref("Selection") }} object; this lets you easily alter the current text selection or cursor position in a browser window.</li> + <li>Support for the <code>window.directories</code> object and the <code>directories</code> feature for {{ domxref("window.open") }}, which are not supported in any other browser, has been removed. Use <code>personalbar</code> instead. {{ Bug(474058) }}</li> + <li>The {{ domxref("event.mozInputSource") }} property has been added to DOM user interface events; this non-standard property lets you determine the type of device that generated an event.</li> + <li>The {{ domxref("document.onreadystatechange") }} event has been implemented.</li> + <li>The {{ domxref("document.createElement") }} method no longer accepts <code><</code> and <code>></code> around the tag name in quirks mode.</li> +</ul> + +<h3 id="Security">Security</h3> + +<dl> + <dt><a href="/en/Introducing_Content_Security_Policy" title="en/Introducing Content Security Policy">Introducing Content Security Policy</a></dt> + <dd>Content Security Policy (CSP) is a Mozilla proposal designed to help web designers and server administrators specify how content on their web sites interacts. The goal is to help detect and mitigate attacks including cross-site scripting and data injection attacks.</dd> + <dt>ForceTLS</dt> + <dd>Details soon.</dd> + <dt>The Account Manager</dt> + <dd>Details soon.</dd> +</dl> + +<h3 id="JavaScript">JavaScript</h3> + +<p>For an overview of the changes implemented in JavaScript 1.8.5, see <a href="/en/New_in_JavaScript_1.8.5" title="en/New in JavaScript 1.8.5">New in JavaScript 1.8.5</a>. JavaScript in Firefox 4 will have additional adherence to the ECMAScript 5 standard.</p> + +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> + +<p>For helpful tips on updating existing extensions for Firefox 4, see <a href="/en/Extensions/Updating_extensions_for_Firefox_4" title="en/Extensions/Updating extensions for Firefox 4">Updating extensions for Firefox 4</a>.</p> + +<h3 id="JavaScript_code_modules">JavaScript code modules</h3> + +<dl> + <dt><a href="/en/JavaScript/Code_modules/Services.jsm" title="en/JavaScript code modules/Services.jsm">Services.jsm</a></dt> + <dd>The <code>Services.jsm</code> code module provides getters that make it easy to obtain references to commonly-used services, such as the preferences service or the window mediator, among others.</dd> +</dl> + +<dl> + <dt><a href="/en/JavaScript/Code_modules/ctypes.jsm" title="en/JavaScript code modules/ctypes.jsm">JS-ctypes API</a></dt> + <dd>The JS-ctypes API makes it possible to call C-compatible foreign library functions without using XPCOM.</dd> + <dt><a href="/en/Addons/Add-on_Manager" title="en/Addons/Add-on Manager">Add-ons Manager</a></dt> + <dd>The new Add-ons Manager provides information about installed add-ons, support for managing them, and provides ways to install and remove add-ons.</dd> + <dt><a href="/en/JavaScript/Code_modules/Using#Locating_the_code_module" title="en/JavaScript code modules/Using JavaScript code modules#Locating the code module">Loading code modules from chrome: URLs</a></dt> + <dd>You can now load JavaScript code modules using <strong>chrome:</strong> URLs, even inside JAR files.</dd> +</dl> + +<h3 id="DOM_changes">DOM changes</h3> + +<dl> + <dt>{{ domxref("ChromeWorker") }}</dt> + <dd>A new type of worker for privileged code; this lets you use things like <a href="/en/js-ctypes" title="en/js-ctypes">js-ctypes</a> from workers in extensions and application code.</dd> +</dl> + +<h3 id="XUL">XUL</h3> + +<h4 id="tabbrowser_(gBrowser)_changes">tabbrowser (gBrowser) changes</h4> + +<p>Several changes were made to the {{ XULElem("tabbrowser") }} element that impact extensions that interact with tabs.</p> + +<ul> + <li>TabClose/TabSelect/TabOpen events no longer bubble up to the {{ XULElem("tabbrowser") }} element (gBrowser). Event listeners for those events should be added to gBrowser.tabContainer rather than to gBrowser directly.</li> + <li>The tab context menu is no longer an anonymous child of the {{ XULElem("tabbrowser") }}. It can therefore be overlaid directly with <a href="/en/XUL_Overlays" title="en/XUL Overlays">XUL overlays</a>. It can also be accessed more directly in JS via gBrowser.tabContextMenu. See <a class="external" href="http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/" title="http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/">this blog post</a> for more details.</li> +</ul> + +<h4 id="Miscellaneous_XUL_changes">Miscellaneous XUL changes</h4> + +<ul> + <li>The {{ xulattr("readonly") }} attribute now correctly works for fields.</li> + <li>The {{ xulelem("resizer") }} element now lets you use the {{ xulattr("element") }} attribute to specify an element to resize, instead of resizing the window.</li> + <li>The "active" attribute no longer gets set on active XUL windows. Instead, you can use the new {{ cssxref(":-moz-window-inactive") }} pseudoclass in order to assign different styles to background windows.</li> + <li>The {{ xulattr("emptytext") }} attribute is now deprecated; you should use {{ xulattr("placeholder") }} instead.</li> + <li>The {{ xulelem("popup") }} element is no longer supported; you should use {{ xulelem("menupopup") }} instead.</li> +</ul> + +<h3 id="Storage">Storage</h3> + +<h4 id="Miscellaneous_storage_API_changes">Miscellaneous storage API changes</h4> + +<ul> + <li>The {{ interface("mozIStorageBindingParamsArray") }} interface now has a length attribute that indicates the number of {{ interface("mozIStorageBindingParams") }} objects in the array.</li> + <li>The {{ ifmethod("mozIStorageStatement", "bindParameters") }} now returns an error if the specified {{ interface("mozIStorageBindingParamsArray") }} is empty.</li> +</ul> + +<h3 id="XPCOM">XPCOM</h3> + +<dl> + <dt><a href="/en/Extensions/Updating_extensions_for_Firefox_4" title="https://developer.mozilla.org/en/Extensions/Updating_extensions_for_Firefox_4">XPCOM changes in Gecko 1.9.3</a></dt> + <dd>Details about changes to XPCOM that impact compatibility in Firefox 4.</dd> + <dt><a href="/en/Components.utils.getGlobalForObject" title="en/Components.utils.getGlobalForObject">Components.utils.getGlobalForObject()</a></dt> + <dd>This new method returns the global object with which an object is associated; this replaces a common use case of the now-removed <code>__parent__</code>.</dd> +</dl> + +<h3 id="Memory_management">Memory management</h3> + +<dl> + <dt><a href="/en/Infallible_memory_allocation" title="en/Infallible memory allocation">Infallible memory allocation</a></dt> + <dd>Mozilla now provides infallible memory allocators that are guaranteed not to return null. You should read this article to learn how they work and how to explicitly request fallible versus infallible memory allocation.</dd> +</dl> + +<h2 id="Other_changes">Other changes</h2> + +<dl> + <dt>Gopher support removed</dt> + <dd>The Gopher protocol is no longer supported natively. Continued support is available via the <a class="link-https" href="https://addons.mozilla.org/addon/7685/">OverbiteFF</a> extension.</dd> + <dt>Default plugin removed</dt> + <dd>The default plugin has been removed. The application plugins folder has also been removed by default, however support for installing plugins via this folder still exists. See <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=533891">bug 533891</a>.</dd> + <dt>Extension Manager replaced with AddonManager</dt> + <dd><a href="/en/XPCOM_Interface_Reference/nsIExtensionManager" title="en/nsIExtensionManager">nsIExtensionManager</a> has been replaced by <a href="/en/Addons/Add-on_Manager/AddonManager" title="en/Addons/Add-on_Manager/AddonManager">AddonManager</a>. Since there is apparently no way at present to obtain the install location from a given extension ID, the closest workaround is to use the directory service to find the profile directory and append "extensions" to it (though this approach will not catch extensions outside of the profile directory or those which are aliased to another location).</dd> +</dl> + +<h2 id="參考">參考</h2> + +<ul> + <li><a href="/en/Firefox_3.6_for_developers" title="en/Firefox 3.6 for developers">Firefox 3.6 for developers</a></li> + <li><a class="internal" href="/En/Firefox_3.5_for_developers" title="En/Firefox 3.5 for developers">Firefox 3.5 for developers</a></li> + <li><a class="internal" href="/en/Firefox_3_for_developers" title="en/Firefox 3 for developers">Firefox 3 for developers</a></li> + <li><a class="internal" href="/en/Firefox_2_for_developers" title="en/Firefox 2 for developers">Firefox 2 for developers</a></li> + <li><a class="internal" href="/en/Firefox_1.5_for_developers" title="en/Firefox 1.5 for developers">Firefox 1.5 for developers</a></li> +</ul> diff --git a/files/zh-tw/mozilla/firefox/releases/4/index.html b/files/zh-tw/mozilla/firefox/releases/4/index.html new file mode 100644 index 0000000000..394f07815e --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/4/index.html @@ -0,0 +1,231 @@ +--- +title: Firefox 4 技術文件 +slug: Mozilla/Firefox/Releases/4 +translation_of: Mozilla/Firefox/Releases/4 +--- +<div>{{FirefoxSidebar}}</div><p>2010 年六月起進入 Beta 測試期的 Firefox 4,增進了效能、加強針對 HTML 5 及其他創新網際科技的支援程度,也更加安全。本文為網頁、附加元件、Gecko 平台開發者們提供這一版的簡要技術相關資訊。</p> + +<div class="geckoVersionNote"> +<p>{{ gecko_callout_heading("2") }}</p> + +<p>Gecko 1.9.3 即將更名為 Gecko 2,但許多文件還沒有針對此點更新,在接下來的幾個星期中才會有所更動。</p> +</div> + +<p>以下大部分的功能都已經可以在 <a class="external" href="http://nightly.mozilla.org/" title="http://nightly.mozilla.org/">逐日建置版</a>中試用。</p> + +<div class="note"><strong>註:</strong>本文、以及本文所連結的其他文件仍持續編修中,很多文件的名稱只是暫定、有些主題的文件也可能會拆成幾份子文件以方便閱讀。中文團隊的目標將僅翻譯這份概覽,其他子文件則有待大家的幫忙。</div> + +<h2 id="Features_for_web_developers">Features for web developers</h2> + +<p>Gecko now uses the <a href="/en/HTML/HTML5" title="en/HTML/HTML5">HTML5</a> parser, which fixes bugs, improves interoperability, and improves performance. It also lets content embed <a href="/en/SVG" title="en/SVG">SVG</a> and <a href="/en/MathML" title="en/MathML">MathML</a> directly in the HTML markup.</p> + +<h3 id="HTML">HTML</h3> + +<dl> + <dt>Introduction to the HTML5 parser</dt> + <dd>A look at what the HTML5 parser means to you, and how to embed SVG and MathML into your content inline.</dd> + <dt><a href="/en/HTML/HTML5/Forms_in_HTML5" title="en/HTML/Forms in HTML5">Forms in HTML5</a></dt> + <dd>A look at improvements to web forms in HTML5.</dd> + <dt><a href="/en/Sections_and_Outlines_of_an_HTML5_document" title="en/Sections and Outlines of an HTML5 document">HTML5 Sections</a></dt> + <dd>Gecko now supports the new HTML5 elements related to sections in a document: {{ HTMLElement("article") }}, {{ HTMLElement("section") }}, {{ HTMLElement("nav") }}, {{ HTMLElement("aside") }}, {{ HTMLElement("hgroup") }}, {{ HTMLElement("header") }} and {{ HTMLElement("footer") }}.</dd> + <dt>Other HTML5 elements</dt> + <dd>Gecko now also supports the following new HTML5 elements: {{ HTMLElement("mark") }}, {{ HTMLElement("figure") }} and {{ HTMLElement("figcaption") }}.</dd> + <dt>WebSockets</dt> + <dd>A guide to using the new WebSockets API for real-time communication between a web application and a server.</dd> +</dl> + +<h4 id="Miscellaneous_HTML_changes">Miscellaneous HTML changes</h4> + +<ul> + <li>{{ HTMLElement("textarea") }} elements are now resizable by default; you can use the {{ cssxref("resize") }} CSS property to disable this.</li> + <li><code>canvas.getContext</code> and <code>canvas.toDataURL</code> no longer throw an exception when called with unrecognized arguments.</li> + <li><code>canvas2dcontext.globalCompositeOperation</code>, <code>canvas2dcontext.lineCap</code> and <code>canvas2dcontext.lineJoin</code> no longer throw an exception when set to an unrecognized value.</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<dl> + <dt><a href="/en/CSS/CSS_transitions" title="en/CSS/CSS transitions">CSS transitions</a></dt> + <dd>New CSS transitions support is available in Firefox 4.</dd> + <dt>Computed values in CSS</dt> + <dd>Support for<code> calc() </code>to compute values in CSS is in progress. See {{ bug(363249) }}.</dd> + <dt>Selector grouping</dt> + <dd>Support for {{ cssxref(":-moz-any") }} to group selectors and factorize combinators.</dd> + <dt>Background image subrectangle support</dt> + <dd>The {{ cssxref("-moz-image-rect") }} property makes it possible to use subrectangles of images as a background image.</dd> + <dt>CSS touch properties</dt> + <dd>Support for touch properties is added. Details, and real article names, to come later.</dd> + <dt><a href="/en/CSS/Privacy_and_the_:visited_selector" title="en/CSS/Privacy and the :visited selector">Privacy and the :visited selector</a></dt> + <dd>Changes have been made to what information can be obtained about the style of visited links using CSS selectors. This may affect some web applications.</dd> +</dl> + +<h4 id="Miscellaneous_CSS_changes">Miscellaneous CSS changes</h4> + +<ul> + <li>The {{ cssxref("text-shadow") }} property now caps the blur radius to 300px for sanity and performance reasons.</li> + <li>The {{ cssxref(":-moz-window-inactive") }} pseudoclass has been implemented.</li> + <li>The {{ cssxref("-moz-tab-size") }} property lets you specify the width in space characters of a tab character (U+0009) when rendering text.</li> + <li>The CSS3 {{ cssxref("resize") }} property has been implemented.</li> + <li>The<code> -moz-background-size </code>property has been renamed to its final {{ cssxref("background-size") }} naming; <code>-moz-background-size</code> is no longer supported.</li> + <li>The {{ cssxref("oveflow") }} property no longer applies to table-group elements ({{ HTMLElement("thead") }}, {{ HTMLElement("tbody") }}, and {{ HTMLElement("tfoot") }}).</li> +</ul> + +<h3 id="Graphics_and_video">Graphics and video</h3> + +<dl> + <dt> </dt> + <dt><a href="/en/WebGL" title="en/WebGL">WebGL</a></dt> + <dd>The developing WebGL standard is now supported by Firefox.</dd> + <dt>Optimizing graphics performance</dt> + <dd>Tips and tricks for getting the most out of graphics and video performance in Firefox 4.</dd> + <dt><a href="/En/Media_formats_supported_by_the_audio_and_video_elements#WebM" title="En/Media formats supported by the audio and video elements#WebM">Support for WebM video</a></dt> + <dd>The new open <a class="external" href="http://www.webmproject.org/" title="http://www.webmproject.org/">WebM</a> video format is supported by Gecko 1.9.3; support is included in nightlies as of 9 June.</dd> + <dt>Full screen API</dt> + <dd>Details coming soon.</dd> + <dt>SMIL animation</dt> + <dd>Support for SMIL animation of SVG is now available. See {{ bug(482402) }}.</dd> + <dt>Using SVG as images and as CSS backgrounds</dt> + <dd>You can now use SVG with the {{ htmlelement("img") }} element, as well as the background image in CSS. See {{ bug(272288) }}, {{ bug(276431) }} and {{ bug(231179) }}.</dd> +</dl> + +<h3 id="DOM">DOM</h3> + +<dl> + <dt>Obtaining boundary rectangles for ranges</dt> + <dd>The Range object now has <code>getClientRects()</code> and <code>getBoundingClientRect()</code> methods. See {{ bug(396392) }}.</dd> + <dt>Capturing mouse events on arbitrary elements</dt> + <dd>Support for the Internet Explorer-originated <code>setCapture()</code> and <code>releaseCapture()</code> APIs has been added. See {{ bug(503943) }}.</dd> + <dt><a href="/en/DOM/Manipulating_the_browser_history" title="en/DOM/Manipulating the browser history">Manipulating the browser history</a></dt> + <dd>The existing document history object, available through the {{ domxref("window.history") }} object, now supports the new HTML5 <code>pushState()</code> and <code>replaceState()</code> methods.</dd> + <dt>Touch and multi-touch events</dt> + <dd>Support has been added for touch and multi-touch events.</dd> + <dt><a href="/en/IndexedDB" title="IndexedDB">IndexedDB</a></dt> + <dd>The proposed IndexedDB standard, which provides a local database store for web applications, will be supported by Firefox 4.</dd> +</dl> + +<h4 id="Miscellaneous_DOM_changes">Miscellaneous DOM changes</h4> + +<ul> + <li>The wrapping of a {{ HTMLElement("textarea") }} element can now be controlled via the DOM, via the <code>wrap</code> DOM attribute. {{ bug(41464) }}</li> + <li>DOM {{ domxref("file") }} objects now offer a <code>url</code> property.</li> + <li>DOM {{ domxref("file") }} objects now have a new <code>click()</code> method. (Note: not done yet, see <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=36619" title="https://bugzilla.mozilla.org/show_bug.cgi?id=36619">bug 36619</a>.)</li> + <li><a href="/En/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects" title="en/XMLHttpRequest/Using XMLHttpRequest#Using FormData objects">FormData</a> support for XMLHttpRequest.</li> + <li>The {{ domxref("element.isContentEditable") }} property has been implemented.</li> + <li>Added the <a href="/En/DragDrop/DataTransfer#mozSourceNode" title="En/DragDrop/DataTransfer#mozSourceNode"><code>mozSourceNode</code></a> property to the <a href="/En/DragDrop/DataTransfer" title="En/DragDrop/DataTransfer"><code>DragTransfer</code></a> object.</li> + <li>Added the <a href="/en/DOM/Selection/modify" title="en/DOM/selection/modify"><code>selection.modify()</code></a> method to the {{ domxref("Selection") }} object; this lets you easily alter the current text selection or cursor position in a browser window.</li> + <li>Support for the <code>window.directories</code> object and the <code>directories</code> feature for {{ domxref("window.open") }}, which are not supported in any other browser, has been removed. Use <code>personalbar</code> instead. {{ Bug(474058) }}</li> + <li>The {{ domxref("event.mozInputSource") }} property has been added to DOM user interface events; this non-standard property lets you determine the type of device that generated an event.</li> + <li>The {{ domxref("document.onreadystatechange") }} event has been implemented.</li> + <li>The {{ domxref("document.createElement") }} method no longer accepts <code><</code> and <code>></code> around the tag name in quirks mode.</li> +</ul> + +<h3 id="Security">Security</h3> + +<dl> + <dt><a href="/en/Security/CSP/Introducing_Content_Security_Policy" title="en/Introducing Content Security Policy">Introducing Content Security Policy</a></dt> + <dd>Content Security Policy (CSP) is a Mozilla proposal designed to help web designers and server administrators specify how content on their web sites interacts. The goal is to help detect and mitigate attacks including cross-site scripting and data injection attacks.</dd> + <dt>ForceTLS</dt> + <dd>Details soon.</dd> + <dt>The Account Manager</dt> + <dd>Details soon.</dd> +</dl> + +<h3 id="JavaScript">JavaScript</h3> + +<p>For an overview of the changes implemented in JavaScript 1.8.5, see <a href="/en/JavaScript/New_in_JavaScript/1.8.5" title="en/New in JavaScript 1.8.5">New in JavaScript 1.8.5</a>. JavaScript in Firefox 4 will have additional adherence to the ECMAScript 5 standard.</p> + +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> + +<p>For helpful tips on updating existing extensions for Firefox 4, see <a href="/en/Extensions/Updating_extensions_for_Firefox_4" title="en/Extensions/Updating extensions for Firefox 4">Updating extensions for Firefox 4</a>.</p> + +<h3 id="JavaScript_code_modules">JavaScript code modules</h3> + +<dl> + <dt><a href="/en/JavaScript_code_modules/Services.jsm" title="en/JavaScript code modules/Services.jsm">Services.jsm</a></dt> + <dd>The <code>Services.jsm</code> code module provides getters that make it easy to obtain references to commonly-used services, such as the preferences service or the window mediator, among others.</dd> +</dl> + +<dl> + <dt><a href="/en/JavaScript_code_modules/ctypes.jsm" title="en/JavaScript code modules/ctypes.jsm">JS-ctypes API</a></dt> + <dd>The JS-ctypes API makes it possible to call C-compatible foreign library functions without using XPCOM.</dd> + <dt><a href="/en/Addons/Add-on_Manager" title="en/Addons/Add-on Manager">Add-ons Manager</a></dt> + <dd>The new Add-ons Manager provides information about installed add-ons, support for managing them, and provides ways to install and remove add-ons.</dd> + <dt><a href="/en/JavaScript_code_modules/Using#Locating_the_code_module" title="en/JavaScript code modules/Using JavaScript code modules#Locating the code module">Loading code modules from chrome: URLs</a></dt> + <dd>You can now load JavaScript code modules using <strong>chrome:</strong> URLs, even inside JAR files.</dd> +</dl> + +<h3 id="DOM_changes">DOM changes</h3> + +<dl> + <dt>{{ domxref("ChromeWorker") }}</dt> + <dd>A new type of worker for privileged code; this lets you use things like <a href="/en/js-ctypes" title="en/js-ctypes">js-ctypes</a> from workers in extensions and application code.</dd> +</dl> + +<h3 id="XUL">XUL</h3> + +<h4 id="tabbrowser_(gBrowser)_changes">tabbrowser (gBrowser) changes</h4> + +<p>Several changes were made to the {{ XULElem("tabbrowser") }} element that impact extensions that interact with tabs.</p> + +<ul> + <li>TabClose/TabSelect/TabOpen events no longer bubble up to the {{ XULElem("tabbrowser") }} element (gBrowser). Event listeners for those events should be added to gBrowser.tabContainer rather than to gBrowser directly.</li> + <li>The tab context menu is no longer an anonymous child of the {{ XULElem("tabbrowser") }}. It can therefore be overlaid directly with <a href="/en/XUL_Overlays" title="en/XUL Overlays">XUL overlays</a>. It can also be accessed more directly in JS via gBrowser.tabContextMenu. See <a class="external" href="http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/" title="http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/">this blog post</a> for more details.</li> +</ul> + +<h4 id="Miscellaneous_XUL_changes">Miscellaneous XUL changes</h4> + +<ul> + <li>The {{ xulattr("readonly") }} attribute now correctly works for fields.</li> + <li>The {{ xulelem("resizer") }} element now lets you use the {{ xulattr("element") }} attribute to specify an element to resize, instead of resizing the window.</li> + <li>The "active" attribute no longer gets set on active XUL windows. Instead, you can use the new {{ cssxref(":-moz-window-inactive") }} pseudoclass in order to assign different styles to background windows.</li> + <li>The {{ xulattr("emptytext") }} attribute is now deprecated; you should use {{ xulattr("placeholder") }} instead.</li> + <li>The {{ xulelem("popup") }} element is no longer supported; you should use {{ xulelem("menupopup") }} instead.</li> +</ul> + +<h3 id="Storage">Storage</h3> + +<h4 id="Miscellaneous_storage_API_changes">Miscellaneous storage API changes</h4> + +<ul> + <li>The {{ interface("mozIStorageBindingParamsArray") }} interface now has a length attribute that indicates the number of {{ interface("mozIStorageBindingParams") }} objects in the array.</li> + <li>The {{ ifmethod("mozIStorageStatement", "bindParameters") }} now returns an error if the specified {{ interface("mozIStorageBindingParamsArray") }} is empty.</li> +</ul> + +<h3 id="XPCOM">XPCOM</h3> + +<dl> + <dt><a href="/en/Extensions/Updating_extensions_for_Firefox_4" title="https://developer.mozilla.org/en/Extensions/Updating_extensions_for_Firefox_4">XPCOM changes in Gecko 1.9.3</a></dt> + <dd>Details about changes to XPCOM that impact compatibility in Firefox 4.</dd> + <dt><a href="/en/Components.utils.getGlobalForObject" title="en/Components.utils.getGlobalForObject">Components.utils.getGlobalForObject()</a></dt> + <dd>This new method returns the global object with which an object is associated; this replaces a common use case of the now-removed <code>__parent__</code>.</dd> +</dl> + +<h3 id="Memory_management">Memory management</h3> + +<dl> + <dt><a href="/en/Infallible_memory_allocation" title="en/Infallible memory allocation">Infallible memory allocation</a></dt> + <dd>Mozilla now provides infallible memory allocators that are guaranteed not to return null. You should read this article to learn how they work and how to explicitly request fallible versus infallible memory allocation.</dd> +</dl> + +<h2 id="Other_changes">Other changes</h2> + +<dl> + <dt>Gopher support removed</dt> + <dd>The Gopher protocol is no longer supported natively. Continued support is available via the <a class="link-https" href="https://addons.mozilla.org/addon/7685/">OverbiteFF</a> extension.</dd> + <dt>Default plugin removed</dt> + <dd>The default plugin has been removed. The application plugins folder has also been removed by default, however support for installing plugins via this folder still exists. See <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=533891">bug 533891</a>.</dd> + <dt>Extension Manager replaced with AddonManager</dt> + <dd><a href="/en/XPCOM_Interface_Reference/nsIExtensionManager" title="en/nsIExtensionManager">nsIExtensionManager</a> has been replaced by <a href="/en/Addons/Add-on_Manager/AddonManager" title="en/Addons/Add-on_Manager/AddonManager">AddonManager</a>. Since there is apparently no way at present to obtain the install location from a given extension ID, the closest workaround is to use the directory service to find the profile directory and append "extensions" to it (though this approach will not catch extensions outside of the profile directory or those which are aliased to another location).</dd> +</dl> + +<h2 id="參考">參考</h2> + +<ul> + <li><a href="/en/Firefox_3.6_for_developers" title="en/Firefox 3.6 for developers">Firefox 3.6 for developers</a></li> + <li><a class="internal" href="/En/Firefox_3.5_for_developers" title="En/Firefox 3.5 for developers">Firefox 3.5 for developers</a></li> + <li><a class="internal" href="/en/Firefox_3_for_developers" title="en/Firefox 3 for developers">Firefox 3 for developers</a></li> + <li><a class="internal" href="/en/Firefox_2_for_developers" title="en/Firefox 2 for developers">Firefox 2 for developers</a></li> + <li><a class="internal" href="/en/Firefox_1.5_for_developers" title="en/Firefox 1.5 for developers">Firefox 1.5 for developers</a></li> +</ul> + +<p>{{ languages( { "en": "en/Firefox_4_for_developers", "de": "de/Firefox_4_fur_Entwickler", "ja": "ja/Firefox_4_for_developers"} ) }}</p> diff --git a/files/zh-tw/mozilla/firefox/releases/5/index.html b/files/zh-tw/mozilla/firefox/releases/5/index.html new file mode 100644 index 0000000000..cba3c4563b --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/5/index.html @@ -0,0 +1,165 @@ +--- +title: Firefox 5 技術文件 +slug: Mozilla/Firefox/Releases/5 +translation_of: Mozilla/Firefox/Releases/5 +--- +<div>{{FirefoxSidebar}}</div> + +<p>Firefox 5,基於 Gecko 5.0,在 2011 年六月21日發行。本文將提供這次發行會對開發者所生影響之資訊。</p> + +<h2 id="網路開發者的改變">網路開發者的改變</h2> + +<h3 id="HTML">HTML</h3> + +<ul> + <li>所有的 HTML 元素現在都有 {{ domxref("element.accessKey", "accessKey") }} 屬性,{{ domxref("element.blur()", "blur()") }}、{{ domxref("element.click()", "click()") }}、{{ domxref("element.focus()", "focus()") }} 方法也是。這些都在 {{ domxref("HTMLElement") }} 介面受到規範化。</li> + <li>為了遵從 HTML5 規範,移除了針對 UTF-7 與 UTF-32 <a href="/zh-TW/Character_Sets_Supported_by_Gecko">字符集</a>的支援。</li> + <li>處於怪異模式(quirks mode)的時候,空白的 {{ HTMLElement("map") }} 支持非空匹配時,再也不跳過。需要更多資訊,請參閱 <a href="/zh-TW/HTML/Element/map#Gecko_notes">Gecko notes</a> 的 {{ HTMLElement("map") }} 元素。</li> + <li>針對 Android 的 Firefox mobile,{{ cssxref("@font-face") }} 現在支援 WOFF 字型。</li> + <li>出於安全考量,WebGL <a href="/zh-TW/WebGL/Cross-Domain_Textures">再也不加載來自其他網域的紋理</a>。<a href="/zh-TW/HTTP_access_control">HTTP access control</a> support should be coming sometime in the future to make this possible more securely.</li> +</ul> + +<h4 id="Canvas_improvements">Canvas improvements</h4> + +<ul> + <li>The {{ HTMLElement("canvas") }} 2D drawing context now supports specifying an <code>ImageData</code> object as the input to the <code>createImageData()</code> method; this <a href="/En/HTML/Canvas/Pixel_manipulation_with_canvas#Creating_an_ImageData_object" title="En/HTML/Canvas/Pixel manipulation with canvas#Creating an ImageData object">creates a new <code>ImageData</code> object</a> initialized with the same dimensions as the specified object, but still with all pixels preset to transparent black. This was documented as implemented already but was not.</li> + <li>Specifying non-finite values when adding color stops through a call to the {{ domxref("CanvasGradient") }} method <code>addColorStop()</code> now correctly throws <code>INDEX_SIZE_ERR</code> instead of <code>SYNTAX_ERR</code>.</li> + <li>The {{ domxref("HTMLCanvasElement") }} method <code>toDataURL()</code> now correctly lower-cases the specified MIME type before matching.</li> + <li><code>getImageData()</code> now correctly accepts rectangles that extend beyond the bounds of the canvas; pixels outside the canvas are returned as transparent black.</li> + <li><code>drawImage()</code> and <code>createImageData()</code> now handle negative arguments in accordance with the specification, by flipping the rectangle around the appropriate axis. <strong>We need an article about <a class="external" href="http://dev.w3.org/csswg/css3-images/#default-sizing" title="http://dev.w3.org/csswg/css3-images/#default-sizing">CSS sizing</a> and how this works.</strong></li> + <li>Specifying non-finite values when calling <code>createImageData()</code> now properly throws a <code>NOT_SUPPORTED_ERR</code> exception.</li> + <li><code>createImageData()</code> and <code>getImageData()</code> now correctly return at least one pixel's worth of image data if a rectangle smaller than one pixel is specified.</li> + <li>Specifying a negative radius when calling <code>createRadialGradient()</code> now correctly throws <code>INDEX_SIZE_ERR</code>.</li> + <li>Specifying a <code>null</code> or <code>undefined</code> image when calling <code>createPattern()</code> or <code>drawImage()</code> now correctly throws a <code>TYPE_MISMATCH_ERR</code> exception.</li> + <li>Specifying invalid values for <code>globalAlpha</code> no longer throws a <code>SYNTAX_ERR</code> exception; these are now correctly silently ignored.</li> + <li>Specifying invalid values when calling <code>translate()</code>, <code>transform()</code>, <code>rect()</code>, <code>clearRect()</code>, <code>fillRect()</code>, <code>strokeRect()</code>, <code>lineTo()</code>, <code>moveTo()</code>, <code>quadraticCurveTo()</code>, or <code>arc()</code> no longer throws an exception; these calls are now correctly silently ignored.</li> + <li>Setting the value of <code>shadowOffsetX</code>, <code>shadowOffsetY</code>, or <code>shadowBlur</code> to an invalid value is now silently ignored.</li> + <li>Setting the value of <code>rotate</code> or <code>scale</code> to an invalid value is now silently ignored.</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<dl> + <dt><a href="/en/CSS/CSS_animations" title="en/CSS/CSS animations">CSS animations</a></dt> + <dd>Support for CSS animations has been added, using the <code>-moz-</code> prefix for now.</dd> +</dl> + +<h3 id="DOM">DOM</h3> + +<ul> + <li>The {{ domxref("selection") }} object's <a href="/en/DOM/Selection/modify" title="en/DOM/Selection/modify"><code>modify()</code></a> method has been changed so that the "word" selection granularity no longer includes trailing spaces; this makes it more consistent across platforms and matches the behavior of WebKit's implementation.</li> + <li>The {{ domxref("window.setTimeout()") }} method now clamps to send no more than one timeout per second in inactive tabs. In addition, it now clamps nested timeouts to the smallest value allowed by the HTML5 specification: 4 ms (instead of the 10 ms it used to clamp to).</li> + <li>Similarly, the {{ domxref("window.setInterval()") }} method now clamps to no more than one interval per second in inactive tabs.</li> + <li><a href="/en/DOM/XMLHttpRequest" title="en/XMLHttpRequest"><code>XMLHttpRequest</code></a> now <a href="/en/DOM/XMLHttpRequest/Using_XMLHttpRequest#Detecting_any_load_end_condition" title="en/XMLHttpRequest/Using XMLHttpRequest#Detecting any load end condition">supports the <code>loadend</code> event</a> for progress listeners. This is sent after any transfer is finished (that is, after the <code>abort</code>, <code>error</code>, or <code>load</code> event). You can use this to handle any tasks that need to be performed regardless of success or failure of a transfer.</li> + <li>The {{ domxref("Blob") }} and, by extension, the {{ domxref("File") }} objects' <code>slice()</code> method has been removed and replaced with a new, proposed syntax that makes it more consistent with <a href="/en/JavaScript/Reference/Global_Objects/Array/slice" title="en/JavaScript/Reference/Global Objects/Array/slice"><code>Array.slice()</code></a> and <a href="/en/JavaScript/Reference/Global_Objects/String/slice" title="en/JavaScript/Reference/Global Objects/String/slice"><code>String.slice()</code></a> methods in JavaScript. This method is named <a href="/en/DOM/Blob#mozSlice()" title="en/DOM/Blob#mozSlice()"><code>mozSlice()</code></a> for now.</li> + <li>The value of {{ domxref("window.navigator.language") }} is now determined by looking at the value of the <code>Accept-Language</code> <a href="/en/HTTP/Headers" title="en/HTTP/Headers">HTTP header</a>.</li> + <li>The {{ domxref("Node.prefix") }} property is now read only, as required by the DOM specification.</li> + <li>The {{ domxref("HTMLVideoElement") }} now supports experimental properties to get information about video paint statistics like frame rates.</li> +</ul> + +<h3 id="JavaScript">JavaScript</h3> + +<ul> + <li>Regular expressions are no longer callable as if they were functions; this change has been made in concert with the WebKit team to ensure compatibility (see {{ WebkitBug(28285) }}. This feature had existed for a long time but was never documented (at least, not here on MDC).</li> + <li>The <a href="/en/JavaScript/Reference/Global_Objects/Function/isGenerator" title="en/JavaScript/Reference/Global Objects/Function/isGenerator"><code>Function.prototype.isGenerator()</code></a> method is now supported; this lets you determine if a function is a <a href="/en/JavaScript/Guide/Iterators_and_Generators#Generators.3a_a_better_way_to_build_Iterators" title="en/Core JavaScript 1.5 Guide/Iterators and Generators#Generators.3a a better way to build Iterators">generator</a>.</li> + <li>The following <a href="/en/JavaScript/Reference/Reserved_Words" title="en/JavaScript/Reference/Reserved Words">reserved words</a> were previously only treated as reserved when in strict mode; now they're always treated as reserved: <code>class</code>, <code>enum</code>, <code>export</code>, <code>extends</code>, <code>import</code>, and <code>super</code>.</li> + <li>DOM documents created in chrome code may no longer be exposed to sandboxed scripts.</li> + <li>The JSON parser has been re-written for improved speed and compliance. This includes a fix for {{ bug("572279") }}.</li> +</ul> + +<h3 id="SVG">SVG</h3> + +<ul> + <li>The {{ SVGAttr("class") }} SVG attribute can now be animated.</li> + <li>The following SVG-related DOM interfaces representing lists of objects are now indexable and can be accessed like arrays; in addition, they have a <code>length</code> property indicating the number of items in the lists: {{ domxref("SVGLengthList") }}, {{ domxref("SVGNumberList") }}, {{ domxref("SVGPathSegList") }}, and {{ domxref("SVGPointList") }}.</li> +</ul> + +<h3 id="HTTP">HTTP</h3> + +<ul> + <li>Firefox no longer sends the <code>Keep-Alive</code> HTTP header; we weren't formatting it correctly, and it was redundant since we were also sending the {{ httpheader("Connection") }} or {{ httpheader("Proxy-Connection") }} header with the value "keep-alive" anyway.</li> + <li>The HTTP transaction model has been updated to be more intelligent about reusing connections in the persistent connection pool; instead of treating the pool as a {{ interwiki("wikipedia", "FIFO") }} queue, Necko now attempts to sort the pool with connections with the largest {{ interwiki("wikipedia", "congestion window") }} (CWND) first. This can reduce the round-trip time (RTT) of HTTP transactions by avoiding the need to grow connections' windows in many cases.</li> + <li>Firefox now handles the <code>Content-Disposition</code> HTTP response header more effectively if both the <code>filename</code> and <code>filename*</code> parameters are provided; it looks through all provided names, using the <code>filename*</code> parameter if one is available, even if a <code>filename</code> parameter is included first. Previously, the first matching parameter would be used, thereby preventing a more appropriate name from being used. See {{ bug(588781) }}.</li> +</ul> + +<h3 id="MathML">MathML</h3> + +<ul> + <li>Support for <a class="external" href="http://www.w3.org/TR/MathML3/chapter3.html#id.3.2.5.7.3" title="http://www.w3.org/TR/MathML3/chapter3.html#id.3.2.5.7.3">embellished operators</a></li> +</ul> + +<h3 id="Developer_tools">Developer tools</h3> + +<ul> + <li>The <a href="/en/Using_the_Web_Console#The_console_object" title="en/Using the Web Console#The console object">Web Console's <code>Console</code> object</a> now has a <code>debug()</code> method, which is an alias for its <code>log()</code> method; this improves compatibility with certain existing sites.</li> +</ul> + +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> + +<p>For a guide to updating your add-on for Firefox 5, please see <a href="/en/Firefox/Updating_add-ons_for_Firefox_5" title="en/Firefox/Updating add-ons for Firefox 5">Updating add-ons for Firefox 5</a>.</p> + +<div class="note"><strong>Note:</strong> Firefox 5 requires that binary components be recompiled, as do all major releases of Firefox. See <a href="/En/Developer_Guide/Interface_Compatibility#Binary_Interfaces" title="En/Developer Guide/Interface Compatibility#Binary Interfaces">Binary Interfaces</a> for details.</div> + +<h3 id="Changes_to_JavaScript_code_modules">Changes to JavaScript code modules</h3> + +<h4 id="New_JavaScript_code_modules">New JavaScript code modules</h4> + +<ul> + <li>The <a href="/en/JavaScript_code_modules/Dict.jsm" title="en/JavaScript code modules/Dict.jsm"><code>Dict.jsm</code></a> code module was added; it provides an API for dictionaries of key/value pairs.</li> +</ul> + +<h4 id="NetUtil.jsm">NetUtil.jsm</h4> + +<ul> + <li>The <a href="/en/JavaScript_code_modules/NetUtil.jsm#asyncFetch()" title="en/JavaScript code modules/NetUtil.jsm#asyncFetch()"><code>asyncFetch()</code></a> method now supports specifying the input source as an {{ interface("nsIInputStream") }}.</li> +</ul> + +<h3 id="Interface_changes">Interface changes</h3> + +<ul> + <li>The {{ interface("nsIHttpChannelInternal") }} interface has new attributes providing access to information about the channels' endpoints' addresses and ports. This information is provided primarily for debugging purposes.</li> + <li>The {{ HTMLElement("canvas") }} element's {{ htmlattrxref("width", "canvas") }} and {{ htmlattrxref("height", "canvas") }} attributes are now reflected in IDL as unsigned integers instead of signed (see <a href="/en/DOM/HTMLCanvasElement" title="en/DOM/HTMLCanvasElement"><code>HTMLCanvasElement</code></a>).</li> + <li>The <code>nsIAppStartup2</code> and {{ interface("nsIAppStartup_MOZILLA_2_0") }} interfaces have been merged into the {{ interface("nsIAppStartup") }} interface.</li> + <li>The <code>nsIDocShell_MOZILLA_2_0_BRANCH</code> interface has been merged into the {{ interface("nsIDocShell") }} interface.</li> + <li>The <code>nsIFocusManager_MOZILLA_2_0_BRANCH</code> interface has been merged into the {{ interface("<code><code>nsIFocusManager</code></code>") }} interface.</li> + <li>The <code>nsIHTMLEditor_MOZILLA_2_0_BRANCH</code> interface has been merged into the {{ interface("nsIHTMLEditor") }} interface.</li> +</ul> + +<h4 id="New_interfaces">New interfaces</h4> + +<ul> + <li><code>nsIDOMAnimationEvent</code> added. {{domxref("AnimationEvent")}}</li> +</ul> + +<h4 id="Removed_interfaces">Removed interfaces</h4> + +<p>The following interfaces were implementation details that are no longer needed:</p> + +<ul> + <li><code>nsICiter</code> (see {{ bug("633066") }})</li> + <li><code>nsIDOM3Document</code> (see {{ bug("639849") }})</li> + <li><code>nsIFIXptrEvaluator</code></li> + <li><code>nsISelectElement</code> (see {{ bug("619996") }})</li> +</ul> + +<h3 id="Debugging_aids">Debugging aids</h3> + +<ul> + <li>The new <a href="/En/Namespace/Mozilla/DebugOnly%3CT%3E" title="En/Namespace/Mozilla/DebugOnly<T>"><code>DebugOnly<T></code></a> helper makes it possible to declare variables only for <code>DEBUG</code> builds.</li> +</ul> + +<h3 id="JavaScript_API_(SpiderMonkey)">JavaScript API (SpiderMonkey)</h3> + +<ul> + <li><a href="/en/SpiderMonkey/JSAPI_Reference/JS_DoubleToInt32" title="en/SpiderMonkey/JSAPI Reference/JS DoubleToInt32"><code>JS_DoubleToInt32()</code></a> and <a href="/en/SpiderMonkey/JSAPI_Reference/JS_DoubleToInt32" title="en/SpiderMonkey/JSAPI Reference/JS DoubleToInt32"><code>JS_DoubleToUint32()</code></a> have been added, for converting <code><a href="/en/SpiderMonkey/JSAPI_Reference/jsdouble" title="en/jsdouble">jsdouble</a></code> values into C integers and unsigned integers.</li> +</ul> + +<h3 id="Build_system_changes">Build system changes</h3> + +<ul> + <li>You can now build Firefox without a <code>mozconfig</code> file; the <a href="/en/Configuring_Build_Options#Choose_an_application" title="en/Configuring Build Options#Choose an application"><code>--enable-application</code> setting</a> now defaults to "browser". After pulling or downloading the code, you can simply <code>configure && make</code> (or <code>make -f client.mk</code>) to build Firefox.</li> +</ul> + +<h2 id="See_also">See also</h2> + +<div>{{Firefox_for_developers('4')}}</div> diff --git a/files/zh-tw/mozilla/firefox/releases/6/index.html b/files/zh-tw/mozilla/firefox/releases/6/index.html new file mode 100644 index 0000000000..bd3141a249 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/6/index.html @@ -0,0 +1,291 @@ +--- +title: Firefox 6 技術文件 +slug: Mozilla/Firefox/Releases/6 +translation_of: Mozilla/Firefox/Releases/6 +--- +<div><section class="Quick_links" id="Quick_Links"> + <ol> + <li class="toggle"> + <details> + <summary>Firefox developer release notes</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Releases">Firefox developer release notes</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>擴充套件</summary> + <ol> + <li><a href="/zh-TW/Add-ons/WebExtensions">瀏覽器擴充功能</a></li> + <li><a href="/zh-TW/Add-ons/Themes">主題</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Firefox internals</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/">Mozilla project</a></li> + <li><a href="/zh-TW/docs/Mozilla/Gecko">Gecko</a></li> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Headless_mode">Headless mode</a></li> + <li><a href="/zh-TW/docs/Mozilla/JavaScript_code_modules">JavaScript 程式碼模組</a></li> + <li><a href="/zh-TW/docs/Mozilla/js-ctypes">JS-ctypes</a></li> + <li><a href="/zh-TW/docs/Mozilla/MathML_Project">MathML 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/MFBT">MFBT</a></li> + <li><a href="/zh-TW/docs/Mozilla/Projects">Mozilla 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/Preferences">Preference system</a></li> + <li><a href="/zh-TW/docs/Mozilla/WebIDL_bindings">WebIDL bindings</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XPCOM">XPCOM</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XUL">XUL</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Building and contributing</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions">建置教學</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options">Configuring build options</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/How_Mozilla_s_build_system_works">How the build system works</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Source_Code/Mercurial">Mozilla 原始碼</a></li> + <li><a href="/zh-TW/docs/Mozilla/Localization">在地化</a></li> + <li><a href="/zh-TW/docs/Mozilla/Mercurial">Mercurial</a></li> + <li><a href="/zh-TW/docs/Mozilla/QA">Quality assurance</a></li> + <li><a href="/zh-TW/docs/Mozilla/Using_Mozilla_code_in_other_projects">在我們的專案中使用 Mozilla 程式碼</a></li> + </ol> + </details> + </li> + </ol> +</section></div><p>Firefox 6, based on Gecko 6.0, was released on August 16, 2011. This article provides links to information about the changes that affect developers in this release.</p> +<h2 id="Changes_for_web_developers">Changes for web developers</h2> +<h3 id="HTML">HTML</h3> +<dl> +</dl> +<ul> + <li>The HTML5 <a href="/zh-TW/docs/Web/HTML/Element/progress" title="The documentation about this has not yet been written; please consider contributing!"><code><progress></code></a> element, which lets you create a progress bar, is now supported.</li> + <li>The parsing of the HTML5 <a href="/zh-TW/docs/Web/HTML/Element/track" title="The documentation about this has not yet been written; please consider contributing!"><code><track></code></a> element, which specifies text tracks for media elements, is now supported. This element should appear in the DOM now, though its behavior is still not implemented.</li> + <li>The <a href="/zh-TW/docs/Web/HTML/Element/iframe" title="The documentation about this has not yet been written; please consider contributing!"><code><iframe></code></a> element is now clipped correctly by its container when the container's corners have been rounded using the <a href="/zh-TW/docs/Web/CSS/border-radius" title="The documentation about this has not yet been written; please consider contributing!"><code>border-radius</code></a> property.</li> + <li><a href="/zh-TW/docs/Web/HTML/Element/form" title="The documentation about this has not yet been written; please consider contributing!"><code><form></code></a> elements' text <a href="/zh-TW/docs/Web/HTML/Element/input" title="The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user."><code><input></code></a> fields no longer support the XUL <code><span><a href="https://developer.mozilla.org/zh-TW/docs/XUL/Property/maxwidth">maxwidth</a></span></code> property; this was never intentional, and is in violation of the HTML specification. You should instead use the <code><a href="/zh-TW/docs/Web/HTML/Element/input#attr-size">size</a></code> attribute to set the maximum width of input fields.</li> + <li>The <a href="/zh-TW/docs/Web/HTML/Element/canvas" title="這個 HTML <canvas> 元素 可以被使用於對腳本程式(JaveScript) 繪圖 .舉例來說, 它能用來畫圖,組合照片,甚至作動畫. 你也許(應該) 在<canvas>區段內提供替代方案的內容 .這內容將能被一些不支援<canvas>以及無法使用Javescript功能的瀏覽器所渲染 ."><code><canvas></code></a> <a href="/zh-TW/docs/Web/API/CanvasRenderingContext2d" title='要取得此實作此介面的實體物件,可以於一個 &lt;canvas> 元素上以 "2d" 為參數呼叫 getContext() 方法:'><code>CanvasRenderingContext2d</code></a> properties <code>fillStyle</code> and <code>strokeStyle</code> used to ignore garbage included after a valid color definition; now this is correctly treated as an error. For example, "red blue" as a color used to be treated as "red", when it should have been ignored.</li> + <li>The width and height of <a href="/zh-TW/docs/Web/HTML/Element/canvas" title="這個 HTML <canvas> 元素 可以被使用於對腳本程式(JaveScript) 繪圖 .舉例來說, 它能用來畫圖,組合照片,甚至作動畫. 你也許(應該) 在<canvas>區段內提供替代方案的內容 .這內容將能被一些不支援<canvas>以及無法使用Javescript功能的瀏覽器所渲染 ."><code><canvas></code></a> elements can now properly be set to 0px; previously, these were getting arbitrarily set to 300px when you tried to do that.</li> + <li>Support for the HTML <a href="/en/HTML/Global_attributes#attr-data-*" title="https://developer.mozilla.org/en/HTML/Global_attributes#attr-data-*">custom data attributes</a> (data-*) has been added. The DOM <a href="/zh-TW/docs/Web/API/Element/dataset" title="The documentation about this has not yet been written; please consider contributing!"><code>element.dataset</code></a> property allows to access them.</li> + <li>When a <a href="/zh-TW/docs/Web/HTML/Element/textarea" title="The documentation about this has not yet been written; please consider contributing!"><code><textarea></code></a> element receives focus, the text insertion point is now placed, by default, at the beginning of the text rather than at the end. This makes Firefox's behavior consistent with other browsers.</li> +</ul> +<h3 id="CSS">CSS</h3> +<dl> + <dt> + <a href="/zh-TW/docs/Web/CSS/text-decoration-color" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-text-decoration-color</code></a></dt> + <dd> + This new property lets you set the color used by text decorations, such as underlines, overlines, and strikethroughs.</dd> + <dt> + <a href="/zh-TW/docs/Web/CSS/text-decoration-line" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-text-decoration-line</code></a></dt> + <dd> + This new property lets you set the kind of text decorations added to an element.</dd> + <dt> + <a href="/zh-TW/docs/Web/CSS/text-decoration-style" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-text-decoration-style</code></a></dt> + <dd> + This new property lets you set the style of text decorations, such as underlines, overlines, and strikethroughs. Styles include single-strokes, double strokes, wavy lines, dotted lines, and so forth.</dd> + <dt> + <a href="/zh-TW/docs/Web/CSS/hyphens" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-hyphens</code></a></dt> + <dd> + This new property lets you control how hyphenation of words during line wrapping is handled.</dd> + <dt> + <a href="/zh-TW/docs/Web/CSS/orient" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-orient</code></a></dt> + <dd> + A new (currently Mozilla-specific) property which lets you control the vertical or horizontal orientation of certain elements (particularly <a href="/zh-TW/docs/Web/HTML/Element/progress" title="The documentation about this has not yet been written; please consider contributing!"><code><progress></code></a>).</dd> + <dt> + <a href="/zh-TW/docs/Web/CSS/::-moz-progress-bar" title="The documentation about this has not yet been written; please consider contributing!"><code>::-moz-progress-bar</code></a></dt> + <dd> + A Mozilla-specific pseudo-element that lets you style the area of an <a href="/zh-TW/docs/Web/HTML/Element/progress" title="The documentation about this has not yet been written; please consider contributing!"><code><progress></code></a> element representing the completed portion of a task.</dd> +</dl> +<h4 id="Other_changes">Other changes</h4> +<ul> + <li>The <a href="/zh-TW/docs/Web/CSS/@-moz-document" title="The documentation about this has not yet been written; please consider contributing!"><code>@-moz-document</code></a> property has a new <code>regexp()</code> function, which lets you match the document's URL to a <a href="/en/JavaScript/Guide/Regular_Expressions" title="en/Core JavaScript 1.5 Guide/Regular Expressions">regular expression</a>.</li> + <li>The <a href="/zh-TW/docs/Web/CSS/azimuth" title="The documentation about this has not yet been written; please consider contributing!"><code>azimuth</code></a> CSS property is no longer supported, as we have removed what little code we had for the <code>aural</code> media group. It was never significantly implemented, so it made more sense to remove the crufty implementation for the time being rather than try to patch it up.</li> + <li>In the past, the <a href="/zh-TW/docs/Web/CSS/:hover" title="The documentation about this has not yet been written; please consider contributing!"><code>:hover</code></a> pseudoclass was not applied to class selectors when in quirks mode; for example, <code>.someclass:hover</code> did not work. This quirk has been removed.</li> + <li>The <a href="/zh-TW/docs/Web/CSS/:indeterminate" title="The documentation about this has not yet been written; please consider contributing!"><code>:indeterminate</code></a> pseudo-class can be applied to <a href="/zh-TW/docs/Web/HTML/Element/progress" title="The documentation about this has not yet been written; please consider contributing!"><code><progress></code></a> elements. This is non-standard, but we hope it will be adopted by other browsers, because it will be useful.</li> + <li>The <code>-moz-win-exclude-glass </code>value has been added to the <a href="/zh-TW/docs/Web/CSS/-moz-appearance" title="The documentation about this has not yet been written; please consider contributing!"><code>-moz-appearance</code></a> CSS property in order to exclude opaque regions in Aero Glass glaze effects on Windows systems.</li> + <li> + <p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=658949" title="FIXED: data URL with hash - content doesn't match location.">bug 658949</a> changed how the hash (#) symbol is treated in data URIs which may break CSS stylesheets which contain such a symbol if it is not escaped.</p> + </li> +</ul> +<h3 id="DOM">DOM</h3> +<dl> + <dt> + <a href="/en/CSS/Using_media_queries_from_code" title="en/CSS/Using media queries from code">Using media queries from code</a></dt> + <dd> + You can now test the result of a media query string programmatically using the <a href="/zh-TW/docs/Web/API/Window/matchMedia" title="The documentation about this has not yet been written; please consider contributing!"><code>window.matchMedia()</code></a> method and the <a href="/zh-TW/docs/Web/API/MediaQueryList" title="MediaQueryList 物件維護一組針對 document 的 media querie , 並且當 media querie 相對應的文件狀態改變時,觸發註冊的事件處理器通知之。"><code>MediaQueryList</code></a> interface.</dd> + <dt> + <a href="/en/DOM/Touch_events" title="en/DOM/Touch events">Touch events</a></dt> + <dd> + Firefox 6 adds support for W3C standard touch events; these make it easy to interpret one or more touches at a time on touch-sensitive surfaces such as touch screens and trackpads.</dd> + <dt> + <a href="/en/Server-sent_events" title="en/Server-sent events">Server-sent events</a></dt> + <dd> + Server-sent events make it possible for a web application to ask a server to send events just like any locally-created DOM event.</dd> +</dl> +<ul> + <li><code>navigator.securityPolicy</code>, which has returned an empty string for a long time, has been removed outright.</li> + <li><a href="/zh-TW/docs/Web/API/BlobBuilder" title="The documentation about this has not yet been written; please consider contributing!"><code>BlobBuilder</code></a> is now implemented, although for now it's prefixed (so you need to use <code>MozBlobBuilder</code>).</li> + <li>The <a href="/zh-TW/docs/Web/API/Document/height" title="The documentation about this has not yet been written; please consider contributing!"><code>document.height</code></a> and <a href="/zh-TW/docs/Web/API/Document/width" title="傳回目前文件中,<body> 元素的寬度有多少像素。"><code>document.width</code></a> have been removed. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=585877" title="FIXED: remove document.height / document.width">bug 585877</a></li> + <li>The <a href="/zh-TW/docs/Web/API/DocumentType" title="DocumentType 介面表示了一個代表文件類型的 Node 節點。"><code>DocumentType</code></a> object's <code>entities</code> and <code>notations</code> properties, which were never implemented and always returned <code>null</code>, have been removed, since they've been removed from the specification anyway.</li> + <li>The <code>DOMConfiguration</code> interface and the <code>document.domConfig</code> property that used it have both been removed; they were never supported and have since been removed from the DOM specification.</li> + <li>The <code>hashchange</code> event now correctly includes <a href="/en/DOM/window.onhashchange#The_hashchange_event" title="en/DOM/window.onhashchange#The hashchange event">the <code>newURL</code> and <code>oldURL</code> fields</a>.</li> + <li>The <a href="/zh-TW/docs/Web/API/FileReader" title="藉由 FileReader 物件,Web 應用程式能以非同步(asynchronously)方式讀取儲存在用戶端的檔案(或原始資料暫存)內容,可以使用 File 或 Blob 物件指定要讀取的資料。"><code>FileReader</code></a> interface's <code>abort()</code> method now throws an exception when used if no file read is in progress.</li> + <li>The <a href="/zh-TW/docs/Web/API/Window/postMessage" title="The documentation about this has not yet been written; please consider contributing!"><code>window.postMessage()</code></a> method now uses <a href="/en/DOM/The_structured_clone_algorithm" title="en/DOM/The structured clone algorithm">the structured clone algorithm</a> to let you pass JavaScript objects instead of just strings from one window to another.</li> + <li>The <a href="/zh-TW/docs/Web/API/Window/history" title="The documentation about this has not yet been written; please consider contributing!"><code>window.history</code></a> API now uses <a href="/en/DOM/The_structured_clone_algorithm" title="en/DOM/The structured clone algorithm">the structured clone algorithm</a> to serialize the objects you pass to the <code>pushState()</code> and <code>replaceState()</code> methods; this lets you use more complex objects (including those that contain cyclic graphs of references).</li> + <li>You can now <a href="/en/Printing#Detecting_print_requests" title="https://developer.mozilla.org/en/Printing#Detecting_print_requests">detect when printing has been initiated and has completed</a> by listening for the new <code>beforeprint</code> and <code>afterprint</code> events.</li> + <li>The <code>document.strictErrorChecking</code> property has been removed, since it was never implemented and was removed from the DOM specification.</li> + <li>The standard <a href="/zh-TW/docs/Web/API/Event/defaultPrevented" title="回傳一個布林值,表示事件的預設行為是否被取消,也就是事件物件是否曾執行 preventDefault() 方法。"><code>event.defaultPrevented</code></a> property is now supported; you should use this instead of the non-standard <code>getPreventDefault()</code> method to detect whether or not <a href="/zh-TW/docs/Web/API/Event/preventDefault" title="如果事件可以被取消,就取消事件(即取消事件的預設行為)。但不會影響事件的傳遞,事件仍會繼續傳遞。"><code>event.preventDefault()</code></a> was called on the event.</li> + <li>The <a href="/zh-TW/docs/Web/API/Window/top" title="The documentation about this has not yet been written; please consider contributing!"><code>window.top</code></a> property is now properly read only.</li> + <li>DOM views, which we never documented, have been removed. This was a bit of implementation detail that was unnecessarily complicating things, so we got rid of it. If you notice this change, you're probably doing something wrong.</li> + <li>The <code>EventTarget</code> function <a href="/en/XPCOM_Interface_Reference/nsIDOMEventTarget" title="en/XPCOM Interface Reference/nsIDOMEventTarget"><code>addEventListener()</code></a>'s <code>useCapture</code> parameter is now optional, as it is in WebKit (and as per the latest version of the specification).</li> + <li>The <code>mozResponseArrayBuffer</code> property of the <a href="/en/DOM/XMLHttpRequest" title="en/XMLHttpRequest"><code>XMLHttpRequest</code></a> object has been replaced with the <code>responseType</code> and <code>response</code> properties.</li> + <li>The <a href="/zh-TW/docs/Web/API/Element/dataset" title="The documentation about this has not yet been written; please consider contributing!"><code>element.dataset</code></a> property has been added to the <a href="/en/DOM/HTMLElement" title="en/DOM/HTMLElement"><code>HTMLElement</code></a> interface allowing access to the <a href="/en/HTML/Global_attributes#attr-data-*" title="https://developer.mozilla.org/en/HTML/Global_attributes#attr-data-*"><code>data-*</code> global attributes</a> of an element.</li> + <li>The <a href="/zh-TW/docs/Web/API/CustomEvent" title="CustomEvent interface 是應用程式為了任意目的所初始化的事件。"><code>CustomEvent</code></a> interface has been implemented. (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=427537" title="FIXED: Implement CustomEvent DOM3 specification">bug 427537</a>)</li> + <li>For security reasons, <code>data:</code> and <code>javascript:</code> URIs no longer inherit the security context of the current page when the user enters them in the location bar; instead, a new, empty, security context is created. This means that script loaded by entering <code>javascript:</code> URIs in the location bar no longer has access to DOM methods and the like, for example. These URIs continue to work as before when used by script, however.</li> +</ul> +<h3 id="JavaScript">JavaScript</h3> +<ul> + <li>In the past, it was possible to use the <code>new</code> operator on several built-in functions (eval, parseInt, Date.parse...) that should not have allowed it, according to the specification. This behavior is no longer supported. Using the <code>new</code> operator in this way was never officially supported and was not widely done, so it's unlikely that this change affects you.</li> + <li>ECMAScript Harmony <a href="/en/JavaScript/Reference/Global_Objects/WeakMap" title="en/JavaScript/Reference/Global_Objects/WeakMap">WeakMaps</a> have been added as a prototype implementation.</li> +</ul> +<h3 id="SVG">SVG</h3> +<ul> + <li>The <code><a href="/zh-TW/docs/Web/SVG/Attribute/pathLength">pathLength</a></code> attribute is now supported.</li> + <li>SVG patterns, gradients, and filters now work correctly when loaded from <a href="/en/data_URIs" title="https://developer.mozilla.org/en/data_URIs"><code>data:</code> URLs</a>.</li> +</ul> +<h3 id="MathML">MathML</h3> +<ul> + <li>The implementation of <code><a href="/zh-TW/docs/Web/MathML/Element/mstyle" title="<mstyle>"><mstyle></a></code> has been corrected.</li> +</ul> +<h3 id="Accessibility_ARIA">Accessibility (ARIA)</h3> +<ul> + <li>A state change event is now correctly sent when the value of <code>aria-busy</code> changes.</li> + <li>An attribute change event is now correctly sent when <code>aria-sort</code> occurs.</li> +</ul> +<h3 id="Networking">Networking</h3> +<dl> + <dt> + <a href="/en/WebSockets" title="en/WebSockets">WebSockets</a></dt> + <dd> + WebSockets was updated to protocol version 07 for Firefox 6. In addition, the global <code>WebSocket</code> object has been renamed to <code>MozWebSocket</code> to prevent it from incorrectly being used to detect the availability of unprefixed WebSockets.</dd> +</dl> +<ul> + <li>Parsing of the <code>Content-Disposition</code> header has been fixed to properly interpret backslash-escaped ASCII characters as just that character itself. Previously it was incorrectly replacing that character with an underscore ("_").</li> + <li>The value of the path field on <code>Set-Cookie</code> headers is now interpreted correctly when quotes are used; previously, they were being treated as part of the path string instead of as delimiters. <strong>This change may affect compatibility with some web sites</strong>, so authors should check their code.</li> + <li>The <a class="external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.42" title="www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"><code>Upgrade</code></a> request header is now supported; you can request an upgrade of an HTTP channel to another protocol by calling <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIHttpChannelInternal#HTTPUpgrade()">nsIHttpChannelInternal.HTTPUpgrade()</a></code>.</li> +</ul> +<h3 id="Other_changes_2">Other changes</h3> +<ul> + <li>Support for microsummaries has been removed; these were never widely used, were not very discoverable, and continuing to support them was making improvements to the Places (bookmark and history) architecture difficult.</li> + <li>WebGL now supports the <a class="external" href="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt" title="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt"><code>OES_texture_float</code></a> extension.</li> + <li>The new <a href="/en/Tools/Scratchpad" title="en/Tools/Scratchpad">Scratchpad</a> tool provides a handy place to experiment with JavaScript code.</li> + <li>The <code>console.trace()</code> method has been added to the <a href="/en/Tools/Web_Console" title="https://developer.mozilla.org/en/Using_the_Web_Console">ConsoleAPI </a>(see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=585956" title="FIXED: Implement console.trace() in web console">bug 585956</a>).</li> +</ul> +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> +<p>For an overview of the changes you may need to make in order to make your add-on compatible with Firefox 6, see <a href="/en/Firefox/Updating_add-ons_for_Firefox_6" title="en/Firefox/Updating add-ons for Firefox 6">Updating add-ons for Firefox 6</a>.</p> +<div class="note"> + <strong>Note:</strong> Firefox 6 requires that binary components be recompiled, as do all major releases of Firefox. See <a href="/En/Developer_Guide/Interface_Compatibility#Binary_Interfaces" title="En/Developer Guide/Interface Compatibility#Binary Interfaces">Binary Interfaces</a> for details.</div> +<h3 id="JavaScript_code_modules">JavaScript code modules</h3> +<h4 id="FileUtils.jsm">FileUtils.jsm</h4> +<ul> + <li>The <code>openSafeFileOutputStream()</code> method now opens files with the <code>DEFER_OPEN</code> <a href="/en/XPCOM_Interface_Reference/nsIFileOutputStream#Behavior_flag_constants" title="en/XPCOM Interface Reference/nsIFileOutputStream#Behavior flag constants">behavior flag</a> instead of attempting to open them immediately.</li> +</ul> +<h4 id="XPCOMUtils.jsm">XPCOMUtils.jsm</h4> +<ul> + <li>The new <a href="/en/JavaScript_code_modules/XPCOMUtils.jsm#importRelative()" title="en/JavaScript code modules/XPCOMUtils.jsm#importRelative()"><code>importRelative()</code></a> method lets you load one JavaScript code module from a path relative to the path of another JavaScript code module. This makes it easier to build modules that depend on each other.</li> +</ul> +<h3 id="XPCOM">XPCOM</h3> +<ul> + <li><a href="/en/XPCOM_array_guide#nsCOMArray.3cT.3e" title="en/XPCOM array guide#nsCOMArray.3cT.3e"><code>nsCOMArray<T></code></a> now has a <a href="/en/XPCOM_array_guide#Deleting_objects" title="en/XPCOM array guide#Deleting objects"><code>RemoveObjectsAt()</code></a> method for removing multiple objects at once from the array.</li> +</ul> +<h3 id="Using_the_DOM_from_chrome">Using the DOM from chrome</h3> +<dl> + <dt> + <a href="/en/Extensions/Using_the_DOM_File_API_in_chrome_code" title="en/Extensions/Using the DOM File API in chrome code">Using the DOM File API in chrome code</a></dt> + <dd> + Although you've always been able to use the DOM File API from chrome code, the <a href="/zh-TW/docs/Web/API/File" title="File 介面提供了檔案的資訊並且允許網頁中的 JavaScript 存取檔案的內容。"><code>File</code></a> constructor now supports specifying a local pathname string when used from chrome. In addition, you can also specify the file to access using the DOM File API using an <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile" title="">nsIFile</a></code> object.</dd> +</dl> +<h3 id="Interface_changes">Interface changes</h3> +<ul> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsINavHistoryQueryOptions" title="">nsINavHistoryQueryOptions</a></code> now supports sorting in frecency order using the new <code>SORT_BY_FRECENCY_ASCENDING</code> and <code>SORT_BY_FRECENCY_DESCENDING</code> constants.</li> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFilePicker" title="">nsIFilePicker</a></code> has a new <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIFilePicker#addToRecentDocs">nsIFilePicker.addToRecentDocs</a></code> attribute, which lets you indicate that the selected file should be added to the user's "recent documents" list if there is one. This attribute has no effect when in private browsing mode.</li> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsINavBookmarkObserver" title="">nsINavBookmarkObserver</a></code> methods with item ID parameters now require a GUID as well.</li> + <li><code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIPrefBranch#clearUserPref()">nsIPrefBranch.clearUserPref()</a></code> no longer throws an exception if the specified preference doesn't exist or has no user-set value. Instead, it simply does nothing.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMemoryReporter" title="">nsIMemoryReporter</a></code> interface now provides support for indicating the kind of memory being described (mapped, heap, or other).</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISHEntry" title="">nsISHEntry</a></code> <code>stateData</code> attribute now returns a <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStructuredCloneContainer" title="">nsIStructuredCloneContainer</a></code>.</li> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIURI" title="">nsIURI</a></code> has a new <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIURI#ref">nsIURI.ref</a></code> attribute, which returns the reference portion (the part after the "#") of the URI. It also has new methods <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIURI#cloneIgnoringRef()">nsIURI.cloneIgnoringRef()</a></code> which clones the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIURI" title="">nsIURI</a></code> without the ref member and <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIURI#equalsExceptRef()">nsIURI.equalsExceptRef()</a></code> which compares to another <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIURI" title="">nsIURI</a></code> ignoring the ref member.</li> +</ul> +<h4 id="New_interfaces">New interfaces</h4> +<dl> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/mozIAsyncFavicons" title="">mozIAsyncFavicons</a></code></dt> + <dd> + A new service that lets you access the favicon service asynchronously.</dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIEventSource" title="">nsIEventSource</a></code></dt> + <dd> + <em>Details forthcoming.</em></dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIGSettingsCollection" title="">nsIGSettingsCollection</a></code></dt> + <dd> + <em>Details forthcoming.</em></dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIGSettingsService" title="">nsIGSettingsService</a></code></dt> + <dd> + <em>Details forthcoming.</em></dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIHttpUpgradeListener" title="">nsIHttpUpgradeListener</a></code></dt> + <dd> + The callback interface for handling HTTP upgrade requests via the <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIHttpChannelInternal#HTTPUpgrade()">nsIHttpChannelInternal.HTTPUpgrade()</a></code> method.</dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStructuredCloneContainer" title="">nsIStructuredCloneContainer</a></code></dt> + <dd> + A container for objects that have been serialized using the <a href="/en/HTML/Structured_clones" title="en/HTML/Structured clones">structured clone algorithm</a>.</dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsITelemetry" title="">nsITelemetry</a></code></dt> + <dd> + Implements telemetry support to allow recording of telemetry data to be used to present histograms for performance tracking purposes. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=649502" title="FIXED: Expose histograms to JS">bug 649502</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=585196" title="FIXED: telemetry infrastructure">bug 585196</a>.</dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsITimedChannel" title="">nsITimedChannel</a></code></dt> + <dd> + See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=576006" title="FIXED: Implement timing interface for channels">bug 576006</a>.</dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWebSocketListener" title="">nsIWebSocketListener</a></code></dt> + <dd> + See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=640003" title="FIXED: WebSockets - upgrade to ietf-07">bug 640003</a>.</dd> + <dt> + <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWebSocketProtocol" title="">nsIWebSocketProtocol</a></code></dt> + <dd> + See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=640003" title="FIXED: WebSockets - upgrade to ietf-07">bug 640003</a>.</dd> +</dl> +<h4 id="Removed_interfaces">Removed interfaces</h4> +<p>The following interfaces were implementation details that are no longer needed:</p> +<ul> + <li><code>nsIDOMDocumentEvent</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=655517" title="FIXED: Remove nsIDOMDocumentEvent">bug 655517</a>)</li> + <li><code>nsIDOMDocumentTraversal</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=655514" title="FIXED: Remove nsIDOMDocumentTraversal">bug 655514</a>)</li> + <li><code>nsIDOMDocumentRange</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=655513" title="FIXED: Remove nsIDOMDocumentRange">bug 655513</a>)</li> + <li><code>IWeaveCrypto</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=651596" title="FIXED: Eliminate IWeaveCrypto">bug 651596</a>)</li> + <li><code>nsIDOM3DocumentEvent</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=481863" title="FIXED: Remove nsIDOM3DocumentEvent">bug 481863</a>)</li> + <li><code>nsIDOMAbstractView</code></li> + <li><code>nsILiveTitleNotificationSubject</code></li> + <li><code>nsIPlugin</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=637253" title="FIXED: decomtamination: remove nsIPlugin and nsIPluginInstance">bug 637253</a>)</li> + <li><code>nsIPluginInstance</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=637253" title="FIXED: decomtamination: remove nsIPlugin and nsIPluginInstance">bug 637253</a>)</li> + <li><code>nsIHTMLEditRules</code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=633750" title="FIXED: deCOM nsIHTMLEditRules">bug 633750</a>)</li> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIXSLTProcessorObsolete" title="">nsIXSLTProcessorObsolete</a></code> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=649534" title="FIXED: Remove nsIXSLTProcessorObsolete">bug 649534</a>)</li> +</ul> +<h3 id="Other_changes_3">Other changes</h3> +<dl> + <dt> + <a href="/en/Mozilla/Preferences/Using_preferences_from_application_code" title="en/Preferences/Using preferences from application code">Using preferences from application code</a></dt> + <dd> + A new static API is available for easily accessing preferences; this is only available to application code and can't be used by add-ons.</dd> +</dl> +<h2 id="See_also">See also</h2> +<div> + <div class="multiColumnList"> +<ul> +<li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/5">Firefox 5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/4">Firefox 4 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.6">Firefox 3.6 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.5">Firefox 3.5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3">Firefox 3 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/2">Firefox 2 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/1.5">Firefox 1.5 for developers</a></li></ul> +</div></div> diff --git a/files/zh-tw/mozilla/firefox/releases/61/index.html b/files/zh-tw/mozilla/firefox/releases/61/index.html new file mode 100644 index 0000000000..e0b9d26ae6 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/61/index.html @@ -0,0 +1,139 @@ +--- +title: Firefox 61 技術變動摘要 +slug: Mozilla/Firefox/Releases/61 +translation_of: Mozilla/Firefox/Releases/61 +--- +<div>{{FirefoxSidebar}}</div><div>{{draft}}</div> + +<p class="summary">此文章提供 Firefox 61 中與開發者較為相關之變動資訊。Firefox 61 預定於 <a href="https://wiki.mozilla.org/RapidRelease/Calendar#Future_branch_dates">2018 年 6 月 26 日正式發表</a>。</p> + +<h2 id="Web_開發相關變動">Web 開發相關變動</h2> + +<h3 id="開發者工具">開發者工具</h3> + +<p><em>無變動。</em></p> + +<h3 id="HTML">HTML</h3> + +<p><em>無變動。</em></p> + +<h3 id="CSS">CSS</h3> + +<p><em>無變動。</em></p> + +<h3 id="SVG">SVG</h3> + +<ul> + <li>{{SVGElement("a")}} 元素({{domxref("SVGAElement")}})新增 <code>ping</code>、<code>rel</code>、<code>referrerPolicy</code>、<code>relList</code>、<code>hreflang</code>、<code>type</code> 及 <code>text</code> 等屬性,以便與 HTML {{HTMLElement("a")}} 元素抱持一致。({{bug("1451823")}})</li> + <li>{{SVGElement("textPath")}} 元素({{domxref("SVGTextPathElement")}})現在支援 SVG2 的 <code>path</code> 及 <code>side</code> 屬性。({{bug("1446617")}} 與 {{bug("1446650")}})</li> + <li>除 {{SVGElement("path")}} 之外,現在有更多元素支援{{domxref("SVGGeometryElement")}} 。({{bug("1325320")}})</li> +</ul> + +<h3 id="JavaScript">JavaScript</h3> + +<ul> + <li>已實作 {{jsxref("String.prototype.trimStart()")}} 及 {{jsxref("String.prototype.trimEnd()")}} 方法(參考 {{bug(1434007)}}。為了確保相容性,將保留 <code>trimLeft</code> 和 <code>trimRight</code> 作為別名。</li> +</ul> + +<h3 id="API">API</h3> + +<h4 id="新_API">新 API</h4> + +<p><em>無變動。</em></p> + +<h4 id="DOM">DOM</h4> + +<ul> + <li>The {{domxref("Document.anchors", "anchors")}}, {{domxref("Document.applets", "applets")}}, {{domxref("Document.embeds", "embeds")}}, {{domxref("Document.forms", "forms")}}, {{domxref("Document.head", "head")}}, {{domxref("Document.images", "images")}}, {{domxref("Document.links", "links")}}, {{domxref("Document.plugins", "plugins")}}, and {{domxref("Document.scripts", "scripts")}} properties have been moved from the {{domxref("HTMLDocument")}} interface onto {{domxref("Document")}} ({{bug(1415588)}}).</li> + <li>The {{domxref("Node.getUserData()")}} and {{domxref("Node.setUserData()")}} methods have been removed from the platform completely ({{bug(749981)}}).</li> + <li>{{domxref("DOMTokenList.replace()")}} now returns a {{domxref("Boolean")}} to indicate whether the replacement occurred successfully, rather than void ({{bug(1444909)}}).</li> +</ul> + +<h4 id="DOM_事件">DOM 事件</h4> + +<p><em>無變動。</em></p> + +<h4 id="Service_workers">Service workers</h4> + +<p><em>無變動。</em></p> + +<h4 id="Media_及_WebRTC">Media 及 WebRTC</h4> + +<p>{{domxref("AudioContext.AudioContext", "AudioContext()")}} 建構式現在可以選擇性傳入一個 {{domxref("AudioContextOptions")}} 型態的 <code>options</code> 參數,用以調整新的 AudioContext 下偏好的延遲時間及取樣率。</p> + +<h4 id="Canvas_及_WebGL">Canvas 及 WebGL</h4> + +<p><em>無變動。</em></p> + +<h3 id="CSSOM">CSSOM</h3> + +<p><em>無變動。</em></p> + +<h3 id="HTTP">HTTP</h3> + +<ul> + <li>已實作 cookie 管理中的 <code><strong>SameSite</strong></code>,見 <a href="/en-US/docs/Web/HTTP/Headers/Set-Cookie">Set-Cookie</a> 及 <a href="/en-US/docs/Web/HTTP/Cookies">HTTP cookies</a>。({{bug(795346)}})</li> +</ul> + +<h3 id="安全性">安全性</h3> + +<p><em>無變動。</em></p> + +<h3 id="外掛程式">外掛程式</h3> + +<p><em>無變動。</em></p> + +<h3 id="其他">其他</h3> + +<p><em>無變動。</em></p> + +<h2 id="Web_平台中移除的項目">Web 平台中移除的項目</h2> + +<h3 id="HTML_2">HTML</h3> + +<p><em>無變動。</em></p> + +<h3 id="CSS_2">CSS</h3> + +<p><em>無變動。</em></p> + +<h3 id="APIs">APIs</h3> + +<p><em>無變動。</em></p> + +<h3 id="SVG_2">SVG</h3> + +<ul> + <li>從未良好實作且已為標準所廢棄的 {{domxref("SVGViewElement")}}<code>.viewTarget</code> 屬性已經移除。({{bug(1455763)}})</li> + <li>在標準規格中廢棄的下列屬性已經自 {{domxref("SVGSVGElement")}} 移除({{bug(1133172)}}): + <ul> + <li><code>pixelUnitToMillimeterX</code></li> + <li><code>pixelUnitToMillimeterY</code></li> + <li><code>screenPixelToMillimeterX</code></li> + <li><code>screenPixelToMillimeterY</code></li> + </ul> + </li> + <li>不在標準規格內的 <code>SVGNumber()</code> 建構式已經移除。({{bug("1455940")}})</li> +</ul> + +<h3 id="其他_2">其他</h3> + +<p><em>無變動。</em></p> + +<h2 id="附加元件及_Mozilla_軟體開發相關變動">附加元件及 Mozilla 軟體開發相關變動</h2> + +<h3 id="WebExtensions">WebExtensions</h3> + +<p><em>無變動。</em></p> + +<h2 id="請參見">請參見</h2> + +<ul> + <li>Firefox 61 網站相容資訊</li> +</ul> + +<h2 id="舊版資訊">舊版資訊</h2> + +<p>{{Firefox_for_developers(60)}}</p> + +<p> </p> diff --git a/files/zh-tw/mozilla/firefox/releases/68/index.html b/files/zh-tw/mozilla/firefox/releases/68/index.html new file mode 100644 index 0000000000..bd6a7e5008 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/68/index.html @@ -0,0 +1,240 @@ +--- +title: Firefox 68 for developers +slug: Mozilla/Firefox/Releases/68 +translation_of: Mozilla/Firefox/Releases/68 +--- +<p>{{FirefoxSidebar}}</p> + +<p class="summary">This article provides information about the changes in Firefox 68 that will affect developers. Firefox 68 was released on July 9, 2019.</p> + +<h2 id="Changes_for_web_developers">Changes for web developers</h2> + +<h3 id="Developer_tools">Developer tools</h3> + +<h4 id="Browserweb_console">Browser/web console</h4> + +<ul> + <li>The Web console now shows <a href="/en-US/docs/Tools/Web_Console/Console_messages#CSS">more information about CSS warnings</a>, including a node list of the DOM elements that used the rule ({{bug(1093953)}}).</li> + <li>You can now filter content in the Web console using regular expressions ({{bug(1441079)}}).</li> + <li>The Browser console now allows you to show or hide messages from the content process by setting or clearing the checkbox labeled <em>Show Content Messages</em> ({{bug(1260877)}}).</li> +</ul> + +<h4 id="JavaScript_debugger">JavaScript debugger</h4> + +<ul> + <li>You can now <a href="/en-US/docs/Tools/Debugger/How_to/Search#Searching_in_all_files">Search</a> in all files in the current project from the debugger by pressing <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>F</kbd> (Windows or Linux) or <kbd>Shift</kbd> + <kbd>Cmd</kbd> + <kbd>F</kbd> (macOS) ({{bug(1320325)}}).</li> +</ul> + +<h4 id="Network_monitor">Network monitor</h4> + +<ul> + <li>The Network monitor <a href="/en-US/docs/Tools/Network_Monitor/request_list#Filtering_requests">request list</a> now allows you to block a specific URL ({{bug(1151368)}}).</li> + <li>You can now resend a network request without editing the method, URL, parameters, and headers, using the <a href="/en-US/docs/Tools/Network_Monitor/request_list#Context_menu">Resend</a> command on the context menu ({{bug(1422014)}}).</li> + <li>The context menu of the Network monitor <a href="/en-US/docs/Tools/Network_Monitor/request_details#Headers">Headers</a> tab now allows you to copy all or some of the header information to the clipboard in JSON format ({{bug(1442249)}}).</li> +</ul> + +<h4 id="Page_inspector">Page inspector</h4> + +<ul> + <li>A button has been added to the <a href="/en-US/docs/Tools/Page_Inspector/How_to/Examine_and_edit_CSS#Examine_CSS_rules">rules panel</a> of the Page inspector that allows you to toggle the display of any print media queries ({{bug(1534984)}}).</li> + <li>The <a href="/en-US/docs/Tools/Page_Inspector/How_to/Edit_fonts">fonts panel</a> now includes a slider to modify <code>letter-spacing</code> ({{bug(1536237)}}).</li> + <li>A warning icon appears next to unsupported CSS properties or rules that have invalid values, to help you understand why certain styles are not being applied ({{bug(1306054)}}).</li> +</ul> + +<h4 id="Storage_inspector">Storage inspector</h4> + +<ul> + <li>You can now <a href="/en-US/docs/Tools/Storage_Inspector#Local_storage_Session_storage">delete local and session storage</a> entries by selecting the item in the storage inspector and pressing the backspace key ({{bug(1522893)}}).</li> +</ul> + +<h4 id="Other">Other</h4> + +<ul> + <li>The <a href="/en-US/docs/Tools/Accessibility_inspector">Accessibility Inspector</a> now includes a new <em>Check for issues</em> feature, which will include a number of audit tools to highlight accessibility problems on your web pages. The first available check is <em>contrast</em>, for highlighting color contrast problems.</li> + <li>The preference that controls the visibility of internal extensions (system add-ons and hidden extensions) on the <a href="/en-US/docs/Tools/about:debugging">about:debugging</a> page has been changed from <code>devtools.aboutdebugging.showSystemAddons</code> to <code>devtools.aboutdebugging.showHiddenAddons</code> ({{bug(1544372)}}).</li> + <li><a href="/en-US/docs/Tools/Responsive_Design_Mode">Responsive design mode</a> has been redesigned — the <em>Device Settings</em> dialog (device selection menu > <em>Edit List...</em>) is now more intuitive and simpler to use ({{bug(1487857)}}).</li> +</ul> + +<h4 id="Removals">Removals</h4> + +<ul> + <li>The "Enable add-on debugging" checkbox has been removed from the <a href="/en-US/docs/Tools/about:debugging">about:debugging</a> page ({{bug(1544813)}}).</li> +</ul> + +<h3 id="HTML">HTML</h3> + +<ul> + <li>The {{HTMLElement("track")}} element — represented by {{domxref("HTMLTrackElement")}} — now receives a {{domxref("HTMLTrackElement.cuechange_event", "cuechange")}} event in addition to the {{domxref("TextTrack")}} itself, if the text track is a contained by a media element ({{bug(1548731)}}).</li> + <li>{{htmlelement("link")}} elements support the <code>disabled</code> attribute again, albeit with different behavior. When <code>disabled</code> is set on a <code><link></code> element along with <code>rel="stylesheet"</code>, the referenced stylesheet is not loaded during page load, and will be loaded on demand when the <code>disabled</code> attribute is changed to <code>false</code> or removed ({{bug(1281135)}}).</li> +</ul> + +<h4 id="Removals_2"> Removals</h4> + +<ul> + <li><code><a href="/en-US/docs/Web/HTML/Element/meta"><meta http-equiv="set-cookie"></a></code> is no longer supported ({{bug(1457503)}}).</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<ul> + <li><a href="/en-US/docs/Web/CSS/CSS_Scroll_Snap">CSS Scroll Snapping</a> has been updated to the latest version of the specification ({{bug(1312163)}}) and ({{bug(1544136)}}), this includes: + + <ul> + <li>The <code>scroll-padding</code> properties ({{bug(1373832)}})</li> + <li>The <code>scroll-margin</code> properties ({{bug(1373833)}})</li> + <li>{{CSSxRef("scroll-snap-align")}} ({{bug(1373835)}})</li> + </ul> + </li> + <li>The {{CSSxRef("-webkit-line-clamp")}} property has been implemented for compatibility with other browsers ({{bug(866102)}}).</li> + <li>Support has been added for the {{CSSxRef("::marker")}} pseudo-element ({{bug(205202)}}) and animation for <code>::marker</code> pseudos ({{bug(1538618)}})</li> + <li>We changed {{CSSxRef("currentColor")}} to be a computed value (except for the {{cssxref("color")}} property) ({{bug(760345)}}).</li> + <li>Support has been fixed for the <code>ch</code> length unit so it now matches the spec (fallback for no '0' glyph, vertical metrics) ({{bug(282126)}})</li> + <li>The {{CSSxRef("counter-set")}} property has been implemented. ({{bug(1518201)}}).</li> + <li>We now implement list numbering using a built-in "list-item" counter; this fixes list numbering bugs ({{bug(288704)}}).</li> + <li>Selector matching and parsing support has been implemented for <code><a href="/en-US/docs/Web/CSS/::part">::part()</a></code> ({{bug(1545430)}}) and ({{bug(1545425)}}).</li> + <li><a href="/en-US/docs/Web/CSS/CSS_Transforms">CSS Transforms</a> are now supported in indirectly rendered things e.g.) {{SVGElement("mask")}}, {{SVGElement("marker")}}, {{SVGElement("pattern")}}, {{SVGElement("clipPath")}} ({{bug(1323962)}}).</li> + <li> + <p>While we're keeping the prefixed versions of the various gradient properties ({{cssxref("linear-gradient")}}, {{cssxref("radial-gradient")}}, and {{cssxref("repeating-radial-gradient")}} available for compatibility reasons, we have revised how they're parsed so that they're handled much more like the non-prefixed versions. This means that certain existing styles won't work correctly.</p> + + <p>In particular, the complicated syntax taking both an angle and a position will no longer work, and the <code>to</code> keyword in the <code><side-or-corner></code> parameter is not required for the prefixed gradient properties. You are encouraged to use the standard, non-prefixed gradient properties instead, as they're now widely supported ({{bug(1547939)}}).</p> + </li> +</ul> + +<h4 id="Removals_3">Removals</h4> + +<ul> + <li>{{CSSxRef("scroll-snap-coordinate")}}, {{CSSxRef("scroll-snap-destination")}}, {{CSSxRef("scroll-snap-type-x")}} and {{CSSxRef("scroll-snap-type-y")}} have been removed.</li> + <li>The {{CSSxRef("scroll-snap-type")}} property has become a longhand, so the old shorthand syntax like <code>scroll-snap-type:mandatory</code> will stop working. See the <a href="https://www.fxsitecompat.com/en-CA/docs/2019/legacy-css-scroll-snap-syntax-support-has-been-dropped/">Firefox Site Compatability</a> note.</li> +</ul> + +<h3 id="SVG">SVG</h3> + +<p><em>No changes.</em></p> + +<h3 id="JavaScript">JavaScript</h3> + +<ul> + <li>The new {{jsxref("BigInt")}} primitive is enabled by default ({{bug(1527902)}}).</li> + <li>String generic methods have been removed ({{bug(1222552)}}). See the <a href="/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_String_generics">deprecation warning</a> for more information.</li> +</ul> + +<h3 id="APIs">APIs</h3> + +<h4 id="CSS_Object_Model_CSSOM">CSS Object Model (CSSOM)</h4> + +<ul> + <li>The legacy {{domxref("CSSStyleSheet.rules", "rules")}} property and {{domxref("CSSStyleSheet.addRule", "addRule()")}} and {{domxref("CSSStyleSheet.removeRule", "removeRule()")}} methods have been added to the {{domxref("CSSStyleSheet")}} interface. These were introduced by Internet Explorer 9 and have never managed to quite be stamped out, so they have been added to improve compatibility with the small percentage of sites that still use them ({{bug(1545823)}}).</li> +</ul> + +<h4 id="DOM">DOM</h4> + +<ul> + <li>The <a href="/en-US/docs/Web/API/Visual_Viewport_API">Visual Viewport API</a> has now been enabled by default on Android ({{bug(1512813)}}). Adding this API to desktop versions of Firefox is being tracked in {{bug(1551302)}}.</li> + <li>The {{domxref("Window")}} feature <code><a href="/en-US/docs/Web/API/Window/open#noreferrer">noreferrer</a></code> is now supported; if specified, the new window's content is loaded without sharing the hostname, IP address, URL, or other identifying information about the host device ({{bug(1527287)}}).</li> + <li>The {{domxref("HTMLImageElement.decode", "decode()")}} method on <code>HTMLImageElement</code> is now implemented. This can be used to trigger loading and decoding of an image prior to adding it to the DOM ({{bug(1501794)}}).</li> + <li>{{domxref("XMLHttpRequest")}} has been updated to no longer accept the non-standard <code>moz-chunked-arraybuffer</code> value for {{domxref("XMLHttpRequest.responseType", "responseType")}}. Code still using it should be updated to <a href="/en-US/docs/Web/API/Streams_API/Using_readable_streams#Consuming_a_fetch_as_a_stream">use the Fetch API as a stream</a> ({{bug(1120171)}}).</li> + <li><code>XMLHttpRequest</code> now outputs a warning to console if you perform a synchronous request while handling an {{domxref("Window.unload_event", "unload")}}, {{domxref("Window.beforeunload_event", "beforeunload")}}, or {{domxref("Window.pagehide_event", "pagehide")}} event ({{bug(980902)}}).</li> + <li>The {{domxref("Document.cookie", "cookie")}} property has moved from the {{domxref("HTMLDocument")}} interface to the {{domxref("Document")}} interface, allowing documents other than {{Glossary("HTML")}} to use cookies ({{bug(144795)}}).</li> + <li>The {{domxref("HTMLElement.focus()")}} and {{domxref("SVGElement.focus()")}} methods now accept an optional object that may contain a boolean <code>preventScroll</code> option specifying whether or not to block the browser from scrolling the newly-focused element into view ({{bug(1374045)}}).</li> +</ul> + +<h4 id="DOM_events">DOM events</h4> + +<ul> + <li><a href="/en-US/docs/Mozilla/Firefox_for_Android">Firefox for Android</a> no longer incorrectly sends a {{domxref("Window.resize_event", "resize")}} event until after the first frame is painted; this improves web compatibility with sites that don't expect this event to occur ({{bug(1528052)}}).</li> + <li>The dispatching of events for non-primary mouse buttons has been made to more closely follow the specification; the {{domxref("Element.click_event", "click")}} event is no longer sent when non-primary buttons are clicked, instead using {{domxref("Element.auxclick_event", "auxclick")}}. In addition, {{domxref("Element.dblclick_event", "dblclick")}} no longer fires for non-primary buttons ({{bug(1379466)}}).</li> + <li>The proprietary {{domxref("MouseEvent.mozPressure")}} property has been deprecated, and will now trigger a warning in the console ({{bug(1165211)}}).</li> +</ul> + +<h4 id="Media_Web_Audio_and_WebRTC">Media, Web Audio, and WebRTC</h4> + +<ul> + <li>Due to changes in the Google Play store's policies, starting with Firefox 68 for Android, the OpenH264 codec used to handle AVC/H.264 video in WebRTC connections can no longer be downloaded and installed. Therefore, fresh installs of Firefox on Android devices no longer support AVC in WebRTC calls. If you upgrade from earlier versions of Firefox and already have the codec downloaded, it will continue to work. This does <em>not</em> affect other platforms. For more details, see <a href="https://support.mozilla.org/en-US/kb/firefox-android-openh264">this article on SUMO</a> or {{bug(1548679)}}.</li> + <li>WebRTC has been updated to recognize that a <code>null</code> candidate passed into the {{domxref("RTCPeerConnection.icecandidate", "icecandidate")}} event handler, indicating the receipt of a candidate, instead indicates that there are no further candidates coming; when this happens the ICE gathering ({{domxref("RTCPeerConnection.iceGatheringState", "iceGatheringState")}}) state reaches <code>complete</code> ({{bug(1318167)}}).</li> + <li>The {{domxref("RTCRtpReceiver")}} methods {{domxref("RTCRtpReceiver.getContributingSources", "getContributingSources()")}} and {{domxref("RTCRtpReceiver.getSynchronizationSources", "getSynchronizationSources()")}} now support video tracks; previously they only worked on audio ({{bug(1534466)}}).</li> + <li>The Web Audio API {{domxref("MediaStreamTrackAudioSourceNode")}} interface is now supported, as is the method {{domxref("AudioContext.createMediaStreamTrackSource()")}} ({{bug(1324548)}}).</li> + <li>{{domxref("RTCDataChannel.negotiated")}} is now implemented ({{bug(1529695)}}).</li> + <li>The {{domxref("MediaStreamAudioSourceNode.MediaStreamAudioSourceNode", "MediaStreamAudioSourceNode()")}} constructor has been updated to match the current specification's definition that the "first audio track" in the stream is the track whose ID comes first in lexicographical order ({{bug(1324548)}}).</li> + <li> + <p>{{domxref("MediaDevices.getUserMedia", "getUserMedia()")}} may no longer be used from a non-secure context; attempting to do so now throws a <code>NotAllowedError</code> exception. Secure contexts are those loaded using HTTPS, those located using the <code>file:///</code> scheme, and those loaded from <code>localhost</code>. For now, if you must, you can re-enable the ability to perform insecure calls to <code>getUserMedia()</code> by setting the preference <code>media.getusermedia.insecure.enabled</code> to <code>true</code> ({{bug(1335740)}}).</p> + + <div class="blockIndicator note"> + <p><strong>Note:</strong> In the future, Firefox will also remove the {{domxref("navigator.mediaDevices")}} property on insecure contexts, preventing all access to the {{domxref("MediaDevices")}} APIs. <strong>This is already the case in Nightly builds.</strong></p> + </div> + </li> +</ul> + +<h4 id="Removals_4">Removals</h4> + +<ul> + <li>Removed the non-standard {{DOMxRef("XMLDocument.load()")}} method ({{bug(332175)}}).</li> + <li>Removed the non-standard {{DOMxRef("XMLDocument.async")}} property ({{bug(1328138)}}).</li> + <li>The {{domxref("RTCIceCredentialType")}} <code>token</code> value has been removed ({{bug(1529595)}}).</li> +</ul> + +<h3 id="HTTP">HTTP</h3> + +<ul> + <li>The <a href="/en-US/docs/Web/HTTP">HTTP</a> {{HTTPHeader("Clear-Site-Data")}} header no longer supports the <code>executionContexts</code> directive. This was removed due to problems with interactions between interconnections among different kinds of data at different points in the navigation process and the way the specification is designed. It <a href="https://github.com/w3c/webappsec-clear-site-data/issues/59">has been proposed</a> that this directive be removed from the specification for this reason, among others ({{bug(1548034)}}).</li> +</ul> + +<h4 id="Removals_5">Removals</h4> + +<ul> + <li>The {{HTTPHeader("Content-Security-Policy")}} directive <code>require-sri-for</code> is no longer supported due to concerns about its standardization status. It was previously available only behind a preference, which was off by default ({{bug(1386214)}}).</li> +</ul> + +<h3 id="Security">Security</h3> + +<ul> + <li>Due to <a href="https://www.mozilla.org/en-US/security/advisories/mfsa2019-21/#CVE-2019-11730">CVE-2019-11730: Same-origin policy treats all files in a directory as having the same-origin</a>, changes have been made so that Firefox now treats files in the same directory as being from different origins. This has a number of side-effects on what will work in documents loaded via file:// URLs (see {{bug("file-fallout")}} for useful background research). For example, workers can no longer be loaded.</li> +</ul> + +<h3 id="WebDriver_conformance_Marionette">WebDriver conformance (Marionette)</h3> + +<h4 id="Bug_fixes">Bug fixes</h4> + +<ul> + <li>If <code>WebDriver:SwitchToWindow</code> changes the selection to a different window it now waits for its <code>focus</code> and <code>activate</code> events before returning ({{bug(1335085)}}).</li> + <li>Fixed the <code>TypeError: this.tabModal is null</code> failure, which sometimes appeared when interacting with modal dialogs or user prompts ({{bug(1538782)}})</li> +</ul> + +<h4 id="Other_2">Other</h4> + +<ul> + <li>Disabled the feature to force unloading background tabs on low memory conditions, to prevent top-level browser contexts from magically disappearing ({{bug(1553748)}}).</li> + <li>Disabled priviledged content processes that caused HTTP authentication dialogs not to appear when navigating to a website after opening a new tab ({{bug(1558763)}}).</li> +</ul> + +<h3 id="Plugins">Plugins</h3> + +<p><em>No changes.</em></p> + +<h2 id="Changes_for_add-on_developers">Changes for add-on developers</h2> + +<h3 id="API_changes">API changes</h3> + +<ul> + <li>The The <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/register">proxy.register()</a></code> and <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/unregister">proxy.unregister()</a></code> functions have been deprecated and will be removed from Firefox 71 ({{bug(1545811)}}).</li> + <li>A <code>boolean</code> flag, <code>incognito</code>, has been added to the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/RequestDetails">proxy.RequestDetails</a>. object. When <code>true</code>, it indicates that this was a private browsing request ({{bug(1545163)}}).</li> + <li>The <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/RequestFilter">webRequest.RequestFilter</a> parameters can include an incognito parameter. If provided, requests that do not match the incognito state (<code>true</code> or <code>false</code>) will be filtered out ({{bug(1548177)}}).</li> + <li>A <code>string</code> value, <code>cookieStoreId</code>, representing the cookie store ID of the current context, has been added to the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/RequestDetails">proxy.RequestDetails</a>. object ({{bug(1545420)}}).</li> + <li>When an add-on attempts to add a bookmark folder to the root folder, the resulting error message is now much more intuitive ({{bug(1512171)}}).</li> + <li>The promise returned by <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/duplicate">browser.tabs.duplicate()</a></code> now resolves immediately, before the tabs are completely loaded ({{bug(1394376)}}).</li> + <li>Support has been added for chrome.storage.managed, allowing web extension settings to be implemented via enterprise policy ({{bug(1230802)}}).</li> +</ul> + +<h3 id="Manifest_changes">Manifest changes</h3> + +<p><em>No changes.</em></p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>Hacks release post: <a href="https://hacks.mozilla.org/2019/07/firefox-68-bigints-contrast-checks-and-the-quantumbar/">Firefox 68: BigInts, Contrast Checks, and the QuantumBar</a></li> + <li><a href="https://www.fxsitecompat.com/en-CA/versions/68/">Site compatibility for Firefox 68</a></li> +</ul> + +<h2 id="Older_versions">Older versions</h2> + +<p>{{Firefox_for_developers(67)}}</p> diff --git a/files/zh-tw/mozilla/firefox/releases/7/index.html b/files/zh-tw/mozilla/firefox/releases/7/index.html new file mode 100644 index 0000000000..3faf9bd904 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/7/index.html @@ -0,0 +1,189 @@ +--- +title: Firefox 7 技術文件 +slug: Mozilla/Firefox/Releases/7 +translation_of: Mozilla/Firefox/Releases/7 +--- +<div>{{FirefoxSidebar}}</div><p>Firefox 7 shipped on September 27, 2011. This article provides information about the changes that affect developers -- both of web content and of Firefox add-ons.</p> +<h2 id="Changes_for_web_developers">Changes for web developers</h2> +<h3 id="HTML">HTML</h3> +<ul> + <li>The {{ domxref("HTMLHeadElement") }} <code>profile</code> property has been removed, this property has been deprecated since {{ gecko("2.0") }}.</li> + <li>The {{ domxref("HTMLImageElement") }} <code>x</code> and <code>y</code> properties have been removed.</li> + <li>The {{ domxref("HTMLSelectElement") }} <code>add()</code> method <code>before</code> parameter is now optional.</li> + <li>The {{ HTMLElement("body") }} element's {{ htmlattrxref("background", "body") }} attribute is no longer resolved as a URI; this is in compliance with the current HTML specification.</li> + <li>The {{ HTMLElement("option") }} element's {{ htmlattrxref("label", "option") }} attribute now reflects the value of the element's text content if the attribute isn't specified.</li> +</ul> +<h4 id="Canvas">Canvas</h4> +<ul> + <li>As part of the <a class="external" href="http://blog.mozilla.com/joe/2011/04/26/introducing-the-azure-project/">Azure project</a> the Direct2D Azure Backend <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=651858">has been implemented</a> and will significantly improve the performance of the 2D canvas.</li> + <li>Specifying invalid values when calling <code>setTransform()</code>, <code>bezierCurveTo()</code>, or <code>arcTo()</code> no longer throws an exception; these calls are now correctly silently ignored.</li> + <li>The <a href="/en/DOM/CanvasRenderingContext2D#isPointInPath()" title="en/DOM/CanvasRenderingContext2D#isPointInPath()"><code>isPointInPath()</code></a> method now correctly considers the transformation matrix when comparing the specified point to the current path.</li> + <li>Calling <code>strokeRect()</code> with a zero width and height now correctly does nothing.</li> + <li>Calling <a href="/en/DOM/CanvasRenderingContext2D#drawImage()" title="en/DOM/CanvasRenderingContext2D#drawImage()"><code>drawImage()</code></a> with a zero width or height {{ HTMLElement("canvas") }} now throws <code>INVALID_STATE_ERR</code>.</li> + <li>Calling <a href="/en/DOM/CanvasRenderingContext2D#drawImage()" title="en/DOM/CanvasRenderingContext2D#drawImage()"><code>drawImage()</code></a> with non-finite coordinates no longer throws an exception.</li> + <li><code>toDataURL()</code> method now accepts a second argument to control JPEG quality.</li> + <li>Support for the non-standard <code>globalCompositeOperation</code> operations <code>clear</code> and <code>over</code> has been removed.</li> + <li><a href="/en/Canvas_tutorial/Applying_styles_and_colors#Shadows" title="en/Canvas_tutorial/Applying_styles_and_colors#Shadows">Shadows</a> are now only drawn for <code>source-over</code> compositing operations.</li> + <li>You can now configure the fill rule used by canvas by setting the <code>mozFillRule </code><a href="/en/DOM/CanvasRenderingContext2D#Attributes" title="en/DOM/CanvasRenderingContext2D#Attributes">attribute</a> on the context.</li> + <li>Support for the experimental <code>mozDash</code>, <code>mozDashOffset</code>, <code>mozCurrentTransform</code> and <code>mozCurrentTransformInverse</code> attributes has been added.</li> + <li>Support for the non-standard methods <code>mozDrawText()</code>, <code>mozMeasureText()</code>, <code>mozPathText()</code> and <code>mozTextAlongPath()</code> has been been removed.</li> +</ul> +<h3 id="CSS">CSS</h3> +<ul> + <li>{{ cssxref("text-overflow") }} is now supported.</li> + <li>The {{ cssxref("orient", "-moz-orient") }} property has been fixed so that {{ HTMLElement("progress") }} elements that are vertically oriented have appropriate default dimensions.</li> +</ul> +<h3 id="MathML">MathML</h3> +<ul> + <li>XLink href has been restored and the MathML3 <code>href</code> attribute is now supported. Developers are encouraged to move to the latter syntax.</li> + <li>Support for the <code>voffset</code> attribute on {{ MathMLElement("mpadded") }} elements has been added and behavior of <code>lspace</code> attribute has been fixed.</li> + <li>The top-level {{ MathMLElement("math") }} element now accepts any attributes of the {{ MathMLElement("mstyle") }} element.</li> + <li>Support for <a class="external" href="http://www.ctan.org/tex-archive/fonts/Asana-Math/">Asana Math</a> fonts has been added.</li> + <li>The <code>medium</code> line thickness of fraction bars in {{ MathMLElement("mfrac") }} elements has been corrected to match the default thickness.</li> + <li><a href="/en/MathML/Attributes/Values#Constants_(namedspaces)" title="en/MathML/Attributes/Values#Constants_(namedspaces)">Names for negative spaces</a> are now supported.</li> +</ul> +<h3 id="DOM">DOM</h3> +<ul> + <li>The {{ domxref("File") }} interface's non-standard methods <code>getAsBinary()</code>, <code>getAsDataURL()</code>, and <code>getAsText()</code> have been removed as well as the non-standard properties <code>fileName</code> and <code>fileSize</code>.</li> + <li>The {{ domxref("XMLHttpRequest/FormData", "FormData") }} interface no longer reports the filename as an empty string when sending the <code>Content-Disposition</code> HTTP header if the data was set using a {{ domxref("Blob") }}. This fixes errors that were happening with some servers.</li> + <li>The {{ domxref("element.dir") }} attribute now always returns its result as all lower-case, as required by the HTML specification.</li> + <li>The {{ domxref("FileReader") }} <code>readAsArrayBuffer()</code> method is now implemented.</li> + <li>{{ domxref("document.createEntityReference") }} has been removed. It was never properly implemented and is not implemented in most other browsers.</li> + <li><code>document.normalizeDocument</code> has been removed. Use {{ domxref("Node.normalize") }} instead.</li> + <li>{{ domxref("DOMTokenList.item") }} now returns <code>undefined</code> if the <code>index</code> is out of bounds, previously it returned <code>null</code>.</li> + <li><code>Node.getFeature</code> has been removed.</li> + <li>The <code>HTMLInsElement</code> and <code>HTMLDelElement</code> interfaces have been removed, since the {{ HTMLElement("ins") }} and {{ HTMLElement("del") }} elements actually use the {{ domxref("HTMLModElement") }} interface.</li> + <li>In a effort to conform to the upcoming <a class="external" href="http://www.w3.org/TR/dom/">DOM4</a> specification where {{ domxref("Attr") }} do not inherit from {{ domxref("Node") }} anymore (it did in DOM Core 1, 2 and 3), many {{ domxref("Node") }} properties and methods on the {{ domxref("Attr") }} interface are <a href="/en/DOM/Attr#Deprecated_properties_and_methods" title="En/DOM/Attr#Deprecated_properties_and_methods">now reporting warnings</a> as we work toward removing them in a later version.</li> + <li>Added support for the {{ domxref("window.ondeviceorientation") }} and {{ domxref("window.ondevicemotion") }} properties on {{ domxref("window") }} objects.</li> + <li>{{ domxref("window.resizeTo") }}, {{ domxref("window.resizeBy") }}, {{ domxref("window.moveTo") }} , and {{ domxref("window.moveBy") }} no longer apply to the main window.</li> +</ul> +<h3 id="JavaScript">JavaScript</h3> +<ul> + <li>The <code><a href="/en/JavaScript/Reference/Global_Objects/Function/arity" title="en/JavaScript/Reference/Global_Objects/Function/arity">Function.arity</a></code> property has been removed; use <code><a href="/en/JavaScript/Reference/Global_Objects/Function/length" title="en/JavaScript/Reference/Global_Objects/Function/length">Function.length</a></code> instead.</li> +</ul> +<h3 id="WebSockets">WebSockets</h3> +<ul> + <li>The <code>network.websocket.max-connections</code> preference is used to determine the maximum number of WebSocket connections that can be open at a time. The default value is 200.</li> + <li>The underlying WebSocket protocol version 8 (as specified by <a class="external" href="http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10" title="http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10">IETF draft 10</a>) is used now instead of the version 7 protocol used by Firefox 6.</li> + <li>The WebSocket API is now available on Firefox Mobile.</li> +</ul> +<h3 id="console_API">console API</h3> +<ul> + <li>Message logged with <code>console.log</code> while the <a href="/en/Tools/Web_Console" title="Using the Web Console">web console</a> isn't open are still logged, although they aren't displayed when the web console is opened.</li> +</ul> +<div class="changelog"> + <h3 id="Web_timing">Web timing</h3> + <ul> + <li>Initial implementation of the <a href="/en/Navigation_timing">Navigation Timing</a> specification which provides data that can be used to measure the performance of a website.</li> + </ul> + <h3 id="XML">XML</h3> + <ul> + <li>In addition to the previously supported <code>text/xsl</code>, XSLT stylesheets can now use the official internet media (MIME) type <code>application/xslt+xml</code> (in the <a class="external" href="http://www.w3.org/TR/xml-stylesheet/" title="http://www.w3.org/TR/xml-stylesheet/">stylesheet processing instruction</a> or the <a class="external" href="http://tools.ietf.org/html/rfc5988">HTTP Link header field</a>).</li> + </ul> +</div> +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> +<p>These changes affect add-on developers as well as developers working on or with Mozilla code itself. Add-on developers should see <a href="/en/Firefox/Updating_extensions_for_Firefox_7" title="en/Firefox/Updating extensions for Firefox 7">Updating extensions for Firefox 7</a> for additional information.</p> +<div class="note"> + <strong>Note:</strong> Firefox 7 requires that binary components be recompiled, as do all major releases of Firefox. See <a href="/En/Developer_Guide/Interface_Compatibility#Binary_Interfaces" title="En/Developer_Guide/Interface_Compatibility#Binary_Interfaces">Binary Interfaces</a> for details.</div> +<h3 id="JavaScript_code_modules">JavaScript code modules</h3> +<h4 id="FileUtils.jsm">FileUtils.jsm</h4> +<ul> + <li>New method <code>openFileOutputStream()</code> opens a file output stream, the non-safe variant, for writing.</li> +</ul> +<h4 id="AddonManager.jsm">AddonManager.jsm</h4> +<ul> + <li>The Add-on Manager has new methods for managing lists of add-ons that changed during applications startup: {{ AMInterface("AddonManager", "addStartupChange") }}, {{ AMInterface("AddonManager", "removeStartupChange") }}, and {{ AMInterface("AddonManager", "getStartupChanges") }}.</li> +</ul> +<h3 id="XUL">XUL</h3> +<ul> + <li>{{ xulelem("tree") }} elements can now persist the state of disclosure triangles if the nodes referenced by {{ XULAttr("datasources") }} all have unique IDs specified by "id" attributes.</li> + <li>{{ xulelem("panel") }} elements can now be configured to <a href="/en/XUL/PopupGuide/Panels#Letting_panels_be_dragged_by_grabbing_the_background" title="en/XUL/PopupGuide/Panels#Letting_panels_be_dragged_by_grabbing_the_background">let the user drag them by clicking anywhere on their background</a> by using the new {{ XULAttr("backdrag") }} attribute.</li> +</ul> +<h3 id="XPCOM">XPCOM</h3> +<ul> + <li>The new <a href="/en/Components.utils.schedulePreciseGC" title="en/Components.utils.schedulePreciseGC"><code>Components.utils.schedulePreciseGC()</code></a> method lets you schedule a thorough garbage collection cycle to occur at some point in the future when no JavaScript code is executing; a callback is executed once collection is complete.</li> + <li>The <a href="/en/Components.utils.unload" title="Components.utils.unload"><code>Components.utils.unload()</code></a> method lets you unload JavaScript code modules previously loaded by calling <a href="/en/Components.utils.load" title="en/Components.utils.load"><code>Components.utils.load()</code></a>.</li> +</ul> +<h3 id="Memory_reporters">Memory reporters</h3> +<p>Support has been added for multi-reporters; that is, memory reporters that gather data on request and call a callback for each generated result. See {{ interface("nsIMemoryMultiReporter") }} and {{ interface("nsIMemoryMultiReporterCallback") }} for the relevant interfaces, as well as the {{ ifmethod("nsIMemoryReporterManager", "registerMultiReporter") }} and {{ ifmethod("nsIMemoryReporterManager", "unregisterMultiReporter") }} methods.</p> +<h3 id="User_experience_changes">User experience changes</h3> +<ul> + <li>Extension options can now be <a href="/en/Extensions/Inline_Options" title="en/Extensions/Inline_Options">displayed inside the Add-on Manager</a> for both restartless and traditional extensions.</li> + <li>The destination of downloads is now remembered on a site-by-site basis. This data can be accessed using <a href="/en/JavaScript_code_modules/DownloadLastDir.jsm" title="en/JavaScript_code_modules/DownloadLastDir.jsm">DownloadLastDir.jsm</a>.</li> +</ul> +<h3 id="Changes_to_the_build_system">Changes to the build system</h3> +<ul> + <li>The ActiveX embedding API is no longer built and support has been removed from the build system. Supporting interfaces have also been removed; see {{ anch("Removed interfaces") }}.</li> + <li>You should no longer specify <code>-Zc:wchar_t-</code> when building on Windows. See the <a href="/En/Developer_Guide/Build_Instructions#Build_and_install" title="En/Developer_Guide/Build_Instructions#Build_and_install">updated Build documentation</a> for details.</li> +</ul> +<h3 id="Interface_changes">Interface changes</h3> +<ul> + <li>{{ interface("nsISocketTransport") }} now offers a new connection flag: <code>DISABLE_IPV6</code>; this causes a socket to only attempt to connect to IPv4 addresses, ignoring any available IPv6 addresses. In addition, {{ interface("nsIDNSService") }} now offers a new resolve flag: <code>RESOLVE_DISABLE_IPV6</code>; this causes domain name resolution to only consider IPv4 hosts, ignoring any available IPv6 addresses. These changes are used to implement the <a class="external" href="http://tools.ietf.org/html/draft-wing-http-new-tech-00">"happy eyeballs" strategy</a> for improving response time when attempting to connect on hosts that support both IPv4 and IPv6 (especially those that have broken IPv6 connectivity).</li> + <li>{{ interface("inIDOMUtils") }} has two new methods, {{ ifmethod("inIDOMUtils","getChildrenForNode") }} which returns a list of child nodes of a node and {{ ifmethod("inIDOMUtils","getUsedFontFaces") }} which returns a list of font faces used in a range.</li> + <li>The <code>nsIMarkupDocumentViewer_MOZILLA_2_0_BRANCH</code> interface has been merged into the {{ interface("nsIMarkupDocumentViewer") }} interface.</li> + <li>The <code>nsIDOMWindow2</code> interface has been merged into the {{ interface("nsIDOMWindow") }} interface.</li> + <li>The <code>nsIDOMWindow_2_0_BRANCH</code> interface has been merged into the {{ interface("nsIDOMWindowInternal") }} interface.</li> + <li>{{ interface("nsINavHistoryObserver") }} methods with URI parameters now require a GUID as well.</li> + <li>The <code>nsISHistory_2_0_BRANCH</code> interface has been merged into the {{ interface("nsISHistory") }} interface.</li> + <li>{{ interface("nsITelemetry") }} has a new method, {{ ifmethod("nsITelemetry","getHistogramById") }} which returns a histogram by its ID, and a new attribute, <code>canRecord</code> which when set to <code>false</code> disables recording of telemetry statistics. Telemetry statistics are no longer recorded when in Private Browsing Mode. (see {{ bug("661574") }} and {{ bug("661573") }})<br> + Telemetry histograms defined with {{ ifmethod("nsITelemetry","newHistogram") }} will not be reported in the telemetry ping.</li> + <li>The {{ interface("nsIMemoryReporter") }} interface has been substantially changed; if you use it, you will need to make some adjustments to your code.</li> + <li>{{ interface("nsIXMLHttpRequest") }}, headers set by {{ ifmethod("nsIXMLHttpRequest","setRequestHeader") }} are sent with the request when following a redirect. Previously these headers would not be sent.</li> + <li>{{ interface("nsIDocShell") }} has a new <code>allowWindowControl</code> attribute. If <code>true</code>, the docshell's content is allowed to control the window (that is, to move or resize the window).</li> + <li>The <code>nsIThreadInternal2</code> interface has been merged into the {{ interface("nsIThreadInternal") }} interface.</li> +</ul> +<h4 id="New_interfaces">New interfaces</h4> +<dl> + <dt> + {{ interface("nsIDOMFontFace") }}</dt> + <dd> + Describes a single font face.</dd> + <dt> + {{ interface("nsIDOMFontFaceList") }}</dt> + <dd> + Describes a list of font faces, each represented by {{ interface("nsIDOMFontFace") }}.</dd> +</dl> +<h4 id="Removed_interfaces">Removed interfaces</h4> +<p>The following interfaces were implementation details that are no longer needed:</p> +<ul> + <li><code>nsIDOM3Attr</code></li> + <li><code>nsIDOM3Node</code></li> + <li><code>nsIDOM3TypeInfo</code></li> + <li><code>nsIDOM3Text</code></li> + <li><code>nsIDOMDocumentStyle</code></li> + <li><code>nsIDOMNSDocument</code></li> + <li><code>nsIDOMNSFeatureFactory</code></li> + <li>{{ interface("nsIDOMNSHTMLDocument") }}</li> + <li><code>nsIDOMNSHTMLFormElement</code></li> + <li><code>nsIDOMNSHTMLHRElement</code></li> + <li><code>nsIDOMNSHTMLTextAreaElement</code></li> +</ul> +<p>The following interfaces were removed as part of the removal of the ActiveX embedding API:</p> +<ul> + <li><code>DITestScriptHelper</code></li> + <li><code>DWebBrowserEvents</code></li> + <li><code>DWebBrowserEvents2</code></li> + <li>{{ interface("IDispatch") }}</li> + <li><code>IMozControlBridge</code></li> + <li><code>IMozPluginHostCtrl</code></li> + <li><code>IWebBrowser</code></li> + <li><code>IWebBrowser2</code></li> + <li><code>IWebBrowserApp</code></li> + <li><code>IXMLDocument</code></li> + <li><code>IXMLElement</code></li> + <li><code>IXMLElementCollection</code></li> + <li><code>IXMLError</code></li> + <li><code>nsIActiveXSecurityPolicy</code></li> + <li>{{ interface("nsIDispatchSupport") }}</li> + <li><code>nsIMozAxPlugin</code></li> + <li><code>nsIScriptEventHandler</code></li> + <li><code>nsIScriptEventManager</code></li> +</ul> +<h3 id="Other_Changes">Other Changes</h3> +<ul> + <li>The structure of the library window (<code>places.xul</code>) <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=588027">has been cleaned up</a>. This <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=677417">may break extensions</a> and themes.</li> + <li>The look of the print preview window <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=663028">has been modernized</a> and theme authors are encouraged to style it using the CSS pseudo-elements {{ cssxref("::-moz-page") }}, {{ cssxref("::-moz-page-sequence") }} and {{ cssxref("::-moz-scrolled-page-sequence") }}.</li> +</ul> +<h2 id="See_also">See also</h2> +<div> + {{Firefox_for_developers('6')}}</div> diff --git a/files/zh-tw/mozilla/firefox/releases/8/index.html b/files/zh-tw/mozilla/firefox/releases/8/index.html new file mode 100644 index 0000000000..51ca78d6e7 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/8/index.html @@ -0,0 +1,259 @@ +--- +title: Firefox 8 技術文件 +slug: Mozilla/Firefox/Releases/8 +translation_of: Mozilla/Firefox/Releases/8 +--- +<div><section class="Quick_links" id="Quick_Links"> + <ol> + <li class="toggle"> + <details> + <summary>Firefox developer release notes</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Releases">Firefox developer release notes</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>擴充套件</summary> + <ol> + <li><a href="/zh-TW/Add-ons/WebExtensions">瀏覽器擴充功能</a></li> + <li><a href="/zh-TW/Add-ons/Themes">主題</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Firefox internals</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/">Mozilla project</a></li> + <li><a href="/zh-TW/docs/Mozilla/Gecko">Gecko</a></li> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Headless_mode">Headless mode</a></li> + <li><a href="/zh-TW/docs/Mozilla/JavaScript_code_modules">JavaScript 程式碼模組</a></li> + <li><a href="/zh-TW/docs/Mozilla/js-ctypes">JS-ctypes</a></li> + <li><a href="/zh-TW/docs/Mozilla/MathML_Project">MathML 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/MFBT">MFBT</a></li> + <li><a href="/zh-TW/docs/Mozilla/Projects">Mozilla 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/Preferences">Preference system</a></li> + <li><a href="/zh-TW/docs/Mozilla/WebIDL_bindings">WebIDL bindings</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XPCOM">XPCOM</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XUL">XUL</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Building and contributing</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions">建置教學</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options">Configuring build options</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/How_Mozilla_s_build_system_works">How the build system works</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Source_Code/Mercurial">Mozilla 原始碼</a></li> + <li><a href="/zh-TW/docs/Mozilla/Localization">在地化</a></li> + <li><a href="/zh-TW/docs/Mozilla/Mercurial">Mercurial</a></li> + <li><a href="/zh-TW/docs/Mozilla/QA">Quality assurance</a></li> + <li><a href="/zh-TW/docs/Mozilla/Using_Mozilla_code_in_other_projects">在我們的專案中使用 Mozilla 程式碼</a></li> + </ol> + </details> + </li> + </ol> +</section></div><p>Firefox 8 was released on November 8, 2011. This article provides information both for <a href="/en/Firefox_8_for_developers#Changes_for_web_developers" title="en/Firefox_8_for_developers#Changes_for_web_developers">web developers</a> and for add-on and <a href="/en/Firefox_8_for_developers#Changes_for_Mozilla_and_add-on_developers" title="en/Firefox_8_for_developers#Changes_for_Mozilla_and_add-on_developers">Mozilla project developers</a> to help take full advantage of the features of this release.</p> + +<h2 id="Changes_for_web_developers">Changes for web developers</h2> + +<h3 id="HTML">HTML</h3> + +<ul> + <li>The <a href="/zh-TW/docs/Web/API/HTMLImageElement" title="HTMLImageElement 介面提供了特殊的屬性及方法以用來操作 <img> 元素的畫面佈局與外觀呈現。"><code>HTMLImageElement</code></a> <code>crossOrigin</code> property has been added and the <code><a href="/zh-TW/docs/Web/HTML/Element/img#attr-crossorigin">crossorigin</a></code> attribute has been added to the <a href="/zh-TW/docs/Web/HTML/Element/img" title="The documentation about this has not yet been written; please consider contributing!"><code><img></code></a> element. (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=664299" title="FIXED: Add crossorigin attribute">bug 664299</a>)</li> + <li>The <a href="/zh-TW/docs/Web/API/HTMLSelectElement#add()" title=""><code>HTMLSelectElement.add()</code></a> method now supports either an item or index of an item that the new item should be inserted before. Previously it only supported an item. (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=666200" title="FIXED: support select.add(element, long before)">bug 666200</a>)</li> + <li>The <code>HTMLIsIndexElement</code> constructor has been removed. No elements have implemented this interface since before Firefox 4.</li> + <li>The HTML5 "context menu" feature (<code>contextmenu</code> attribute), which lets you add custom element specific items to native context menu, is now supported (the implementation is still experimental awaiting changes in the specification; see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=617528" title='FIXED: implement the HTML5 "context menu" feature (contextmenu attribute)'>bug 617528</a>).</li> + <li>Support for the <a href="/en/HTML/Global_attributes#attr-accesskeylabel" title="https://developer.mozilla.org/en/HTML/Global_attributes#attr-accesskeylabel"><code>accesskeylabel</code></a> attribute has been added to all elements.</li> + <li>The <a href="/zh-TW/docs/Web/HTML/Element/input" title="The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user."><code><input></code></a> and <a href="/zh-TW/docs/Web/HTML/Element/textarea" title="The documentation about this has not yet been written; please consider contributing!"><code><textarea></code></a> elements now support the <code>selectionDirection</code> attribute, and their <code>setSelectionRange()</code> methods have been updated to support optionally specifying a direction.</li> + <li>Most elements now get a focus ring drawn around them if they've been made focusable by using the <code>tabindex</code> attribute and the user then focuses the element.</li> + <li>In a set of nested <a href="/zh-TW/docs/Web/HTML/Element/label" title="The documentation about this has not yet been written; please consider contributing!"><code><label></code></a> elements click events do no longer trigger multiple <label> elements, which caused Firefox to stop responding in the past (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=646157" title="FIXED: Stops responding when selecting a checkbox on the Netapp admin page inside deeply nested <label>s">bug 646157</a>).</label></li> +</ul> + +<h3 id="DOM">DOM</h3> + +<ul> + <li>The <a href="/zh-TW/docs/Web/API/Element/insertAdjacentHTML" title="insertAdjacentHTML() 把傳入的字串解析成 HTML 或 XML,並把該節點插入到 DOM 樹指定的位置。它不會重新解析被使用的元素,因此他不會破壞該元素裡面原有的元素。這避免了序列化的複雜步驟,使得它比直接操作 innerHTML 快上許多。"><code>insertAdjacentHTML</code></a> method has been implemented.</li> + <li><a href="/zh-TW/docs/Web/API/BlobBuilder" title="The documentation about this has not yet been written; please consider contributing!"><code>BlobBuilder</code></a> now has a <code>getFile()</code> method that returns the content of the blob as a file.</li> + <li>The <a href="/zh-TW/docs/Web/API/FileReaderSync" title="The documentation about this has not yet been written; please consider contributing!"><code>FileReaderSync</code></a> interface (part of the FileAPI) has been implemented.</li> + <li>Event handling in nested <a href="/zh-TW/docs/Web/HTML/Element/label" title="The documentation about this has not yet been written; please consider contributing!"><code><label></code></a>s has been fixed.</li> + <li>You can now use <a href="/zh-TW/docs/Web/API/Window/postMessage" title="The documentation about this has not yet been written; please consider contributing!"><code>window.postMessage()</code></a> to pass <a href="/zh-TW/docs/Web/API/File" title="File 介面提供了檔案的資訊並且允許網頁中的 JavaScript 存取檔案的內容。"><code>File</code></a> and <a href="/zh-TW/docs/Web/API/FileList" title='FileList 型別物件通常來自 HTML &lt;input> 元素 DOM 物件的 files 屬性(property)。你可以操作 FileList 物件來存取使用者透過 &lt;input type="file"> 元素所選取的檔案,或由拖放操作所產生的檔案(請參考 DataTransfer 物件的更多使用細節)。'><code>FileList</code></a> objects between windows.</li> + <li>When editing <a href="/zh-TW/docs/Web/API/Element/contenteditable" title="The documentation about this has not yet been written; please consider contributing!"><code>element.contenteditable</code></a> areas, exiting a heading by pressing return, or exiting list editing mode by pressing return twice, now returns to paragraph entry mode (that is, paragraphs inside <a href="/zh-TW/docs/Web/HTML/Element/p" title="The documentation about this has not yet been written; please consider contributing!"><code><p></code></a> blocks) instead of separating lines by <a href="/zh-TW/docs/Web/HTML/Element/br" title="HTML <br> 元素會產生文字的斷行(carriage-return、CR 或是確認鍵)。此元素主要用於寫詩或寫住址,這種斷行有所意義的時候。"><code><br></code></a> elements.</li> + <li>Fixed a bug that prevents justification from taking effect properly when applied to the first line in a <a href="/zh-TW/docs/Web/API/Element/contenteditable" title="The documentation about this has not yet been written; please consider contributing!"><code>element.contenteditable</code></a> area.</li> + <li>Fixed a bug that caused pressing delete or backspace at the beginning of a <a href="/zh-TW/docs/Web/API/Element/contenteditable" title="The documentation about this has not yet been written; please consider contributing!"><code>element.contenteditable</code></a> area to affect the previous <code>contenteditable</code> block if one is present.</li> + <li><a href="/zh-TW/docs/Web/API/Document/getSelection" title="The documentation about this has not yet been written; please consider contributing!"><code>document.getSelection()</code></a> now returns the same <code>Selection</code> object as <a href="/zh-TW/docs/Web/API/Window/getSelection" title="The documentation about this has not yet been written; please consider contributing!"><code>window.getSelection()</code></a>, instead of <em>stringifying</em> it.</li> + <li>The HTML5 <code>selectionDirection</code> property makes it possible to define the direction of the selection in an editable text.</li> + <li><a href="/zh-TW/docs/Web/API/HTMLMediaElement" title="The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video."><code>HTMLMediaElement</code></a> now have a <code>seekable</code> property that return a <a href="/zh-TW/docs/Web/API/TimeRanges" title="The documentation about this has not yet been written; please consider contributing!"><code>TimeRanges</code></a> object.</li> + <li>The <a href="/zh-TW/docs/Web/API/HTMLMediaElement" title="The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video."><code>HTMLMediaElement</code></a><code>.preload</code> attribute now correctly reflects as an <em>enumerated value</em>.</li> + <li><a href="/en/HTML/CORS_settings_attributes" title="en/HTML/CORS_settings_attributes"><code>crossOrigin</code> property</a> defaults to "Anonymous" when an invalid value is used.</li> + <li><a href="/zh-TW/docs/Web/API/Window/navigator/cookieEnabled" title="The documentation about this has not yet been written; please consider contributing!"><code>window.navigator.cookieEnabled</code></a> now returns correct information when the default cookie setting is overridden on a per-site basis.</li> +</ul> + +<h3 id="JavaScript">JavaScript</h3> + +<ul> + <li><code><a href="/en/JavaScript/Reference/Global_Objects/RegExp/exec" title="en/JavaScript/Reference/Global Objects/RegExp/exec">RegExp.exec()</a></code> and <code><a href="/en/JavaScript/Reference/Global_Objects/RegExp/test" title="en/JavaScript/Reference/Global Objects/RegExp/test">RegExp.test()</a></code> called with no arguments now match against the string "undefined".</li> + <li><code><a href="/en/JavaScript/Reference/Global_Objects/String/search" title="en/JavaScript/Reference/Global Objects/String/search">String.search()</a></code> and <code><a href="/en/JavaScript/Reference/Global_Objects/String/match" title="en/JavaScript/Reference/Global Objects/String/match">String.match()</a></code> called with no arguments or <code>undefined</code> now match against the empty string and thus match every string.</li> + <li>Support for watchlists has been implemented with the new (non-standard) <a href="/en/JavaScript/Reference/Global_Objects/Object/watch" title="en/JavaScript/Reference/Global_Objects/Object/watch"><code>watch()</code></a> and <a href="/en/JavaScript/Reference/Global_Objects/Object/unwatch" title="en/JavaScript/Reference/Global_Objects/Object/unwatch"><code>unwatch()</code></a> methods.</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<ul> + <li><a href="/zh-TW/docs/Web/CSS/resolution" title="The documentation about this has not yet been written; please consider contributing!"><code>resolution</code></a> now accepts <a href="/zh-TW/docs/Web/CSS/number" title="The documentation about this has not yet been written; please consider contributing!"><code><number></code></a>, not just <a href="/zh-TW/docs/Web/CSS/integer" title="The documentation about this has not yet been written; please consider contributing!"><code><integer></code></a> values as per the specification.</li> + <li>Hyphenation rules have been added for many new languages when using <a href="/zh-TW/docs/Web/CSS/hyphens" title="The documentation about this has not yet been written; please consider contributing!"><code>hyphens</code></a>.</li> + <li>Handling of <a href="/zh-TW/docs/Web/CSS/background-size" title="The documentation about this has not yet been written; please consider contributing!"><code>background-size</code></a> has been revised to more closely match the specification.</li> + <li>In the past, <a href="/zh-TW/docs/Web/CSS/text-decoration" title="The documentation about this has not yet been written; please consider contributing!"><code>text-decoration</code></a> in quirks mode had line thickness and position adjusted on descendant text to match the descendant. Now standards mode and quirks mode rendering are more similar.</li> + <li>Horizontal positioning for elements has been brought more in line with the specification in many cases. Documentation for this is forthcoming, but for now, see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=682780" title="jig.com looks different in aurora vs. firefox">bug 682780</a>, comment 23 for details.</li> + <li><a href="/en/CSS/Scaling_of_SVG_backgrounds" title="en/CSS/Scaling_of_SVG_backgrounds">SVG images are now scaled properly</a> when used as background images.</li> +</ul> + +<h3 id="Network">Network</h3> + +<ul> + <li>Double quotes are no longer accepted as a delimiter for <a href="https://tools.ietf.org/html/rfc2231">RFC 2231</a> or <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a> encoding, as per those RFCs.</li> + <li>MIME header field parser (<code>Content-Disposition</code>) now requires "=" in parameters.</li> + <li>Scripts are no longer downloaded when JavaScript is disabled.</li> + <li>SSL 2.0 is no longer supported.</li> +</ul> + +<h3 id="WebSockets">WebSockets</h3> + +<ul> + <li>The <a href="/en/WebSockets/WebSockets_reference/WebSocket" title="WebSocket"><code>WebSocket</code></a> object's <a href="/en/WebSockets/WebSockets_reference/WebSocket#send()" title="en/WebSockets/WebSockets reference/WebSocket#send()"><code>send()</code></a> method no longer incorrectly returns a Boolean value.</li> + <li>The <a href="/en/WebSockets/WebSockets_reference/WebSocket" title="WebSocket"><code>WebSocket</code></a> object's <a href="/en/WebSockets/WebSockets_reference/WebSocket#close()" title="en/WebSockets/WebSockets_reference/WebSocket#close()"><code>close()</code></a> method now matches the current draft of the standard, and close events now properly use the <a href="/en/WebSockets/WebSockets_reference/CloseEvent" title="CloseEvent"><code>CloseEvent</code></a> interface.</li> + <li>The <a href="/en/WebSockets/WebSockets_reference/WebSocket" title="WebSocket"><code>WebSocket</code></a> object's <code>extensions</code> attribute is now supported.</li> + <li>The WebSocket constructor now supports an array of protocols as well as a single protocol string.</li> + <li>Mixed content is not allowed with WebSockets; that is, you can no longer open a connection to a non-secure WebSocket server from secure content.</li> + <li>Connection errors with WebSockets now trigger the <code>onerror</code> handler.</li> + <li><a href="/en/WebSockets" title="en/WebSockets">WebSocket</a> API has been updated to the latest draft of the specification (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=674890" title="FIXED: Update WebSocket API to latest draft - send() should return void">bug 674890</a>, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=674527" title="FIXED: Update WebSocket API to latest draft - array of protocols in ctor">bug 674527</a>, and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=674716" title="FIXED: Update WebSocket API to latest draft - close codes and reasons">bug 674716</a>).</li> + <li>The deflate-stream extension to WebSockets has been disabled; it has been deprecated, and was breaking compatibility with some sites.</li> +</ul> + +<h3 id="WebGL">WebGL</h3> + +<ul> + <li><a href="/en/WebGL/Cross-Domain_Textures" title="en/WebGL/Cross-Domain Textures">Cross-domain textures</a> can now be allowed with CORS approval.</li> + <li>Cross-process rendering with Direct2D/Direct3D 10.</li> +</ul> + +<h3 id="MathML">MathML</h3> + +<ul> + <li>Support for the <code>displaystyle</code> attribute on the top-level <code><a href="/zh-TW/docs/Web/MathML/Element/math" title="<math>"><math></a></code> element has been added.</li> + <li>The interpretation of negative row numbers for the <code>align</code> attribute on <code><a href="/zh-TW/docs/Web/MathML/Element/mtable" title="<mtable>"><mtable></a></code> has been corrected.</li> +</ul> + +<h3 id="Developer_tools">Developer tools</h3> + +<ul> + <li>The <a href="/en/Tools/Web_Console#The_console_object" title="en/Using_the_Web_Console#The_console_object"><code>console</code></a> object has a new <code>dir()</code> method, which displays an interactive list of the properties on a specified object.</li> +</ul> + +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> + +<p>See <a href="/en/Firefox/Updating_add-ons_for_Firefox_8" title="en/Firefox/Updating_add-ons_for_Firefox_8">Updating add-ons for Firefox 8</a> for a guide to changes you're likely to have to make to make your add-ons compatible with Firefox 8.</p> + +<div class="note"><strong>Note:</strong> Firefox 8 requires that binary components be recompiled, as do all major releases of Firefox. See <a href="/En/Developer_Guide/Interface_Compatibility#Binary_Interfaces" title="En/Developer_Guide/Interface_Compatibility#Binary_Interfaces">Binary Interfaces</a> for details.</div> + +<h3 id="XPCOM">XPCOM</h3> + +<dl> + <dt><a href="/en/Components.utils" title="en/Components.utils"><code>Components.utils</code></a></dt> + <dd>The new methods <a href="/en/Components.utils.createObjectIn" title="en/Components.utils.createObjectIn"><code>Components.utils.createObjectIn()</code></a> and <a href="/en/Components.utils.makeObjectPropsNormal" title="en/Components.utils.makeObjectPropsNormal"><code>Components.utils.makeObjectPropsNormal()</code></a> have been created to make it easier to create objects in specific compartments.</dd> +</dl> + +<h4 id="Other_XPCOM_related_changes">Other XPCOM related changes</h4> + +<ul> + <li>You can now instantiate DOM <a href="/zh-TW/docs/Web/API/File" title="File 介面提供了檔案的資訊並且允許網頁中的 JavaScript 存取檔案的內容。"><code>File</code></a> objects from component code by simply doing new File, instead of having to instantiate an <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMFile" title="">nsIDOMFile</a></code> directly.</li> + <li>The <code>nsTPtrArray</code> array type has been removed. Its functionality is now all available on <code>nsTArray</code>, which now offers the <code>SafeElementAt()</code> method when instantiated using a pointer type. See the section on <a href="/en/XPCOM_array_guide#Bounds-safe_access_to_elements" title="en/XPCOM_array_guide#Bounds-safe_access_to_elements"><code>SafeElementAt()</code></a> in the <a href="/en/XPCOM_array_guide" title="XPCOM array guide">XPCOM array guide</a> for more information.</li> +</ul> + +<h3 id="Workers">Workers</h3> + +<p>It is no longer possible to access XPCOM objects from ChromeWorkers. XPConnect has been disabled in worker contexts as of <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=649537" title="FIXED: Workers: Make one OS thread and JS runtime per worker, and lose XPConnect">bug 649537</a>.</p> + +<h3 id="XUL">XUL</h3> + +<ul> + <li>A bug in <a href="/zh-TW/docs/Web/API/Document/execCommand" title="当一个HTML文档切换到设计模式,文档对象会暴漏execCommand 方法,可以让用户运行命令操作可编辑区域的内容。大多指令作用于文档的选择(加粗,斜体等等),另外一些则是插入新元素(如添加一个链接)或者作用于一整行(如缩进)。当使用contentEditable 属性时,使用execCommand() 将会作用于当前激活的可编辑区域。"><code>document.execCommand()</code></a> that occurred when calling it on the value of <code><span><a href="https://developer.mozilla.org/zh-TW/docs/XUL/Property/contentDocument">contentDocument</a></span></code> has been fixed. Since Firefox 3, this resulted in errors instead of working correctly.</li> + <li><a href="/en/Extensions/Bootstrapped_extensions" title="Bootstrapped extensions">Bootstrapped add-ons</a> can now load chrome using a <a href="/en/Chrome_Registration" title="en/chrome.manifest"><code>chrome.manifest</code></a> file. See the section <a href="/en/Extensions/Bootstrapped_extensions#Adding_user_interface_with_a_chrome.manifest" title="en/Extensions/Bootstrapped_extensions#Adding_user_interface_with_a_chrome.manifest">Adding user interface with a chrome.manifest</a> for details.</li> + <li><a href="/en/XUL/image" title="en/XUL/image">XUL images</a> now shrink down with the same ratio in both directions when specifying maximum sizes.</li> +</ul> + +<h3 id="Changes_to_the_build_system">Changes to the build system</h3> + +<ul> + <li>The following build configuration options have been removed: + <ul> + <li><code>--enable-timeline</code></li> + <li><code>--disable-storage</code></li> + <li><code>--necko-disk-cache</code></li> + </ul> + </li> + <li>When compiling IDL files to headers, the header file <code>jspubtd.h</code> is automatically included when needed. Manual inclusions of <code>jspubtd.h</code> and/or <code>jsapi.h</code> in IDL files that use jsval or [implicit_jscontext] are no longer necessary.</li> +</ul> + +<h3 id="Chrome_registration">Chrome registration</h3> + +<ul> + <li>The <a href="/en/Chrome_Registration#platformversion" title="en/Chrome_Registration#platformversion"><code>platformversion</code></a> flag can be used in the chrome.manifest to specify Gecko version compatibility.</li> +</ul> + +<h3 id="Interface_changes">Interface changes</h3> + +<ul> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/mozIJSSubScriptLoader#loadSubScript()">mozIJSSubScriptLoader.loadSubScript()</a></code> method now loads scripts from the startup cache when possible.</li> + <li>The <code>ownerWindow</code> attribute has been removed from the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIAccessNode" title="">nsIAccessNode</a></code> interface.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMStorageWindow" title="">nsIDOMStorageWindow</a></code> interface has been merged into the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindow" title="">nsIDOMWindow</a></code> interface.</li> + <li>All members of the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindowInternal" title="">nsIDOMWindowInternal</a></code> interface have been moved into the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindow" title="">nsIDOMWindow</a></code> interface. The interface itself (with no members) remains available for compatibility until Firefox 9.</li> + <li>In order to improve performance, callback handling for asynchronous Places database updates has been changed. See the new <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/mozIVisitInfoCallback#handleResult()">mozIVisitInfoCallback.handleResult()</a></code> and <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/mozIVisitInfoCallback#handleError()">mozIVisitInfoCallback.handleError()</a></code> methods, which replace the old single method for both error and success condition handling.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMemoryReporter" title="">nsIMemoryReporter</a></code> <code>KIND_MAPPED</code> attribute has been deprecated in favor of <code>KIND_NONHEAP</code>, new unit types <code>UNITS_COUNT_CUMULATIVE</code> and <code>UNITS_PERCENTAGE</code> have been added.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMemoryReporterManager" title="">nsIMemoryReporterManager</a></code> interface has a new <code>explicit</code> attribute, which reports the total size of explicit memory allocations.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMemoryReporterManager" title="">nsIMemoryReporterManager</a></code> interface has a new <code>resident</code> attribute, which reports the amount of physical memory used.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsINetworkLinkService" title="">nsINetworkLinkService</a></code> interface has a new attribute, <code>linkType</code>. This attribute provides the type of network connection in use. All Operating Systems currently return <code>LINK_TYPE_UNKNOWN</code>. Android support was backed out due to perceived security concerns.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISelection2" title="">nsISelection2</a></code> interface has been merged into the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISelectionPrivate" title="">nsISelectionPrivate</a></code> interface.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISelection3" title="">nsISelection3</a></code> interface has been merged into the <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISelection" title="">nsISelection</a></code> interface.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISessionStartup" title="">nsISessionStartup</a></code> attribute state is now a <a href="/En/SpiderMonkey/JSAPI_Reference/Jsval" title="en/jsval"><code>jsval</code></a> instead of a string, for performance reasons.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDocShell" title="">nsIDocShell</a></code> attribute <code>isActive</code> is now <code>false</code> for minimized windows.</li> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIDownloadHistory#addDownload()">nsIDownloadHistory.addDownload()</a></code> method now saves <span id="summary_alias_container"><span id="short_desc_nonedit_display">the the target where the download is saved on the local file system.</span></span></li> +</ul> + +<h4 id="Removed_interfaces">Removed interfaces</h4> + +<p>The following interfaces were implementation details that are no longer needed:</p> + +<ul> + <li><code>nsITimelineService</code></li> + <li><code>nsIDOMHTMLIsIndexElement</code></li> +</ul> + +<p>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWorkerFactory" title="">nsIWorkerFactory</a></code> interface has been removed as well. Workers can still be created using the <code>Worker</code> and <code>ChromeWorker</code> constructors.</p> + +<h3 id="Other_changes">Other changes</h3> + +<ul> + <li>When a window is minimized, un-minimized, or switches between full screen and windowed mode, it receives a <code>sizemodechange</code> event.</li> + <li>You can now <a href="/en/Installing_extensions#Preventing_automatic_install_from_specific_locations" title="en/Installing_extensions#Preventing_automatic_install_from_specific_locations">use the <code>extensions.autoDisableScopes</code> preference</a> to disable automatic installation of add-ons from specific add-on install locations.</li> + <li>The new <a href="/zh-TW/docs/Web/API/Document/mozSyntheticDocument" title="The documentation about this has not yet been written; please consider contributing!"><code>document.mozSyntheticDocument</code></a> property on <a href="/zh-TW/docs/Web/API/Document" title="Document 介面代表所有在瀏覽器中載入的網頁,也是作為網頁內容 DOM 樹"><code>Document</code></a> objects lets you determine whether a document is synthetic (that is, something like a standalone image, video, or audio file) rather than a full, standard DOM document. This can be useful, for example, if you want to present different user interface in this situation (such as adding contextual items differently depending on this case).</li> + <li>You can now specify a filter when opening <code>about:config</code>; for example, "about:config?filter=sessionstore" will show only session storage related preferences.</li> +</ul> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en/Firefox_7_for_developers" title="en/Firefox_7_for_developers">Firefox 7 for developers</a></li> + <li><a href="/en/Firefox_6_for_developers" title="en/Firefox_6_for_developers">Firefox 6 for developers</a></li> + <li><a href="/en/Firefox_5_for_developers" title="en/Firefox_5_for_developers">Firefox 5 for developers </a></li> + <li><a href="/en/Firefox_4_for_developers" title="en/Firefox_4_for_developers">Firefox 4 for developers </a></li> + <li><a href="/en/Firefox_3.6_for_developers" title="en/Firefox_3.6_for_developers">Firefox 3.6 for developers </a></li> + <li><a href="/En/Firefox_3.5_for_developers" title="En/Firefox_3.5_for_developers">Firefox 3.5 for developers</a></li> + <li><a href="/en/Firefox_3_for_developers" title="en/Firefox_3_for_developers">Firefox 3 for developers</a></li> + <li><a href="/en/Firefox_2_for_developers" title="en/Firefox_2_for_developers">Firefox 2 for developers</a></li> + <li><a href="/en/Firefox_1.5_for_developers" title="en/Firefox_1.5_for_developers">Firefox 1.5 for developers</a></li> +</ul> diff --git a/files/zh-tw/mozilla/firefox/releases/9/index.html b/files/zh-tw/mozilla/firefox/releases/9/index.html new file mode 100644 index 0000000000..39e727c628 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/9/index.html @@ -0,0 +1,231 @@ +--- +title: Firefox 9 技術文件 +slug: Mozilla/Firefox/Releases/9 +translation_of: Mozilla/Firefox/Releases/9 +--- +<div><section class="Quick_links" id="Quick_Links"> + <ol> + <li class="toggle"> + <details> + <summary>Firefox developer release notes</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Releases">Firefox developer release notes</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>擴充套件</summary> + <ol> + <li><a href="/zh-TW/Add-ons/WebExtensions">瀏覽器擴充功能</a></li> + <li><a href="/zh-TW/Add-ons/Themes">主題</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Firefox internals</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/">Mozilla project</a></li> + <li><a href="/zh-TW/docs/Mozilla/Gecko">Gecko</a></li> + <li><a href="/zh-TW/docs/Mozilla/Firefox/Headless_mode">Headless mode</a></li> + <li><a href="/zh-TW/docs/Mozilla/JavaScript_code_modules">JavaScript 程式碼模組</a></li> + <li><a href="/zh-TW/docs/Mozilla/js-ctypes">JS-ctypes</a></li> + <li><a href="/zh-TW/docs/Mozilla/MathML_Project">MathML 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/MFBT">MFBT</a></li> + <li><a href="/zh-TW/docs/Mozilla/Projects">Mozilla 專案</a></li> + <li><a href="/zh-TW/docs/Mozilla/Preferences">Preference system</a></li> + <li><a href="/zh-TW/docs/Mozilla/WebIDL_bindings">WebIDL bindings</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XPCOM">XPCOM</a></li> + <li><a href="/zh-TW/docs/Mozilla/Tech/XUL">XUL</a></li> + </ol> + </details> + </li> + <li class="toggle"> + <details> + <summary>Building and contributing</summary> + <ol> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions">建置教學</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options">Configuring build options</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Build_Instructions/How_Mozilla_s_build_system_works">How the build system works</a></li> + <li><a href="/zh-TW/docs/Mozilla/Developer_guide/Source_Code/Mercurial">Mozilla 原始碼</a></li> + <li><a href="/zh-TW/docs/Mozilla/Localization">在地化</a></li> + <li><a href="/zh-TW/docs/Mozilla/Mercurial">Mercurial</a></li> + <li><a href="/zh-TW/docs/Mozilla/QA">Quality assurance</a></li> + <li><a href="/zh-TW/docs/Mozilla/Using_Mozilla_code_in_other_projects">在我們的專案中使用 Mozilla 程式碼</a></li> + </ol> + </details> + </li> + </ol> +</section></div> + +<p>Firefox 9 was released for Windows on December 20, 2011. Mac and Linux version 9.0.1, which fixed a crashing bug discovered at the last minute, were released on December 21, 2011.</p> + +<h2 id="Changes_for_web_developers">Changes for web developers</h2> + +<h3 id="HTML">HTML</h3> + +<ul> + <li>The <code>value</code> attribute of <a href="/zh-TW/docs/Web/HTML/Element/li" title="The documentation about this has not yet been written; please consider contributing!"><code><li></code></a> now can be negative as specified in HTML5. Previously negative values were converted to 0.</li> + <li>You can now <a href="/en-US/docs/Using_HTML5_audio_and_video#Specifying_playback_range" title="en-US/docs/Using_HTML5_audio_and_video#Specifying_playback_range">specify the start and stop time of media</a> in the URI of the media when using <a href="/zh-TW/docs/Web/HTML/Element/audio" title="The documentation about this has not yet been written; please consider contributing!"><code><audio></code></a> and <a href="/zh-TW/docs/Web/HTML/Element/video" title="The documentation about this has not yet been written; please consider contributing!"><code><video></code></a> elements.</li> + <li><a href="/zh-TW/docs/Web/HTML/Element/input" title="The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user."><code><input></code></a> and <a href="/zh-TW/docs/Web/HTML/Element/textarea" title="The documentation about this has not yet been written; please consider contributing!"><code><textarea></code></a> elements <a href="/en-US/docs/HTML/Controlling_spell_checking_in_HTML_forms#Controlling_the_spellchecker_language" title="en-US/docs/HTML/Controlling_spell_checking_in_HTML_forms#Controlling_the_spellchecker_language">now respect the value of the <code>lang</code> attribute</a> when invoking the spell checker.</li> + <li>Firefox on Android now lets users snap photos with their phone's camera without leaving the browser when the <a href="/zh-TW/docs/Web/HTML/Element/input" title="The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user."><code><input></code></a> element is used with <code>type="file"</code> and <code>accept="image/*"</code>.</li> + <li>Windows Vista style PNG ICO images are now supported.</li> + <li>Drawing images that use the <a href="/en-US/docs/HTML/CORS_settings_attributes" title="CORS settings attributes"><code>crossorigin</code></a> attribute to request CORS access no longer incorrectly <a href="/en-US/docs/CORS_Enabled_Image#What_is_a_.22tainted.22_canvas.3F" title="en-US/docs/CORS_Enabled_Image#What_is_a_.22tainted.22_canvas.3F">taint the canvas</a> when CORS is granted.</li> + <li>The value of the <code><a href="/zh-TW/docs/Web/HTML/Element/td#attr-rowspan">rowspan</a></code> attribute may now be as large as 65,534, up from 8190.</li> +</ul> + +<h3 id="CSS">CSS</h3> + +<ul> + <li>The <a href="/zh-TW/docs/Web/CSS/font-stretch" title="The documentation about this has not yet been written; please consider contributing!"><code>font-stretch</code></a> property is now supported.</li> + <li>The <a href="/zh-TW/docs/Web/CSS/columns" title="The documentation about this has not yet been written; please consider contributing!"><code>columns</code></a> property is now supported, with the <code>-moz</code> prefix. This is a shorthand for the following properties: <a href="/zh-TW/docs/Web/CSS/column-width" title="The documentation about this has not yet been written; please consider contributing!"><code>column-width</code></a> and <a href="/zh-TW/docs/Web/CSS/column-count" title="The documentation about this has not yet been written; please consider contributing!"><code>column-count</code></a>.</li> + <li>When a stylesheet included using the <a href="/zh-TW/docs/Web/HTML/Element/link" title="The documentation about this has not yet been written; please consider contributing!"><code><link></code></a> element has been fully loaded and parsed (but not yet applied to the document), a <a href="/en-US/docs/HTML/Element/link#Stylesheet_load_events" title="en-US/docs/HTML/Element/link#Stylesheet_load_events"><code>load</code> event</a> is now fired. Also, if an error occurs processing a style sheet, an <code>error</code> event is fired.</li> + <li>You can now specify overflow settings for both the left and right edges of content using a new two-value syntax for <a href="/zh-TW/docs/Web/CSS/text-overflow" title="The documentation about this has not yet been written; please consider contributing!"><code>text-overflow</code></a>.</li> +</ul> + +<h3 id="JavaScript">JavaScript</h3> + +<p><em>No change.</em></p> + +<h3 id="DOM">DOM</h3> + +<dl> + <dt><a href="/en-US/docs/DOM/Using_full-screen_mode" title="Using full-screen mode">Using full-screen mode</a></dt> + <dd>The new full-screen API provides a way to present content using the entire screen, with no browser interface. This is great for video and games. This API is currently experimental and prefixed.</dd> +</dl> + +<ul> + <li>The <a href="/zh-TW/docs/Web/API/Node/contains" title="The documentation about this has not yet been written; please consider contributing!"><code>Node.contains()</code></a> method is now implemented; this lets you determine if a given node is a descendant of another node.</li> + <li>The <a href="/zh-TW/docs/Web/API/Node/parentElement" title="The documentation about this has not yet been written; please consider contributing!"><code>Node.parentElement</code></a> attribute has been implemented; this returns the parent <a href="/zh-TW/docs/Web/API/Element" title="Element 介面表示了一個在 Document 中的物件,其描述了各類型元素的共同屬性與方法,Element 的子介面則定義了不同類型元素的具體行為並增加額外的功能。"><code>Element</code></a> of a DOM node, or <code>null</code> if the parent isn't an element.</li> + <li>DOM Level 3 <a href="/en-US/docs/DOM/CompositionEvent" title="CompositionEvent">composition events</a> are now supported.</li> + <li>The <a href="/zh-TW/docs/Web/API/Document/scripts" title="The documentation about this has not yet been written; please consider contributing!"><code>Document.scripts</code></a> attribute has been implemented; this returns an <a href="/zh-TW/docs/Web/API/HTMLCollection" title="HTMLCollection 介面表示了一種成員為 Element 物件的通用集合(如 arguments 一般的類陣列,成員順序同元素在文件中的順序),並提供了可用來選取集合成員的方法與屬性。"><code>HTMLCollection</code></a> of all the <a href="/zh-TW/docs/Web/HTML/Element/script" title="HTML <script> 元素能嵌入或引用要執行的程式碼。最常見的用途是嵌入或引用 JavaScript 程式碼。"><code><script></code></a> elements on the document.</li> + <li>The <a href="/zh-TW/docs/Web/API/Document/queryCommandSupported" title="The documentation about this has not yet been written; please consider contributing!"><code>Document.queryCommandSupported()</code></a> method has been implemented.</li> + <li>The set of events that can be listened for on <a href="/zh-TW/docs/Web/HTML/Element/body" title="The documentation about this has not yet been written; please consider contributing!"><code><body></code></a> elements has been revised to match the latest draft of the HTML5 specification. The list of events in the <a href="/en-US/docs/DOM/DOM_event_reference" title="DOM event reference">DOM event reference</a> reflects which events can be listened for on <a href="/zh-TW/docs/Web/HTML/Element/body" title="The documentation about this has not yet been written; please consider contributing!"><code><body></code></a>.</li> + <li>The <code>readystatechange</code> event is now fired only on the <a href="/zh-TW/docs/Web/API/Document" title="Document 介面代表所有在瀏覽器中載入的網頁,也是作為網頁內容 DOM 樹"><code>Document</code></a>, as intended.</li> + <li>Event handlers are now implemented as standard IDL interfaces. For most cases, this won't affect content, but <a href="/en-US/docs/DOM/DOM_event_handlers#Event_handler_changes_in_Firefox_9" title="en-US/docs/DOM/DOM_event_handlers#Event_handler_changes_in_Firefox_9">there are exceptions</a>.</li> + <li>A new response type, "<code>moz-json</code>", has been added to <code>XMLHttpRequest</code>, letting <code>XMLHttpRequest</code> automatically parse <a href="/en-US/docs/JSON" title="JSON">JSON</a> strings for you; when you request this type, a returned JSON string is parsed, so that the value of the <code>response</code> property is the resulting JavaScript object.</li> + <li><a href="/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Monitoring_progress" title="en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Monitoring_progress"><code>XMLHttpRequest</code> "progress" events</a> are now reliably sent for every chunk of data received; in the past it was possible for the last chunk of data received to not fire a "progress" event. Now you can track progress by following only "progress" events, instead of also having to monitor "load" events to detect the receipt of the last chunk of data.</li> + <li>In the past, calling <a href="/en-US/docs/DOM/element.addEventListener" title="element.addEventListener"><code>addEventListener()</code></a> with a <code>null</code> listener would throw an exception. Now it returns without error and with no effect.</li> + <li>The new <a href="/zh-TW/docs/Web/API/Navigator/doNotTrack" title="The documentation about this has not yet been written; please consider contributing!"><code>navigator.doNotTrack</code></a> property lets your content easily determine whether or not the user has enabled their do-no-track preference; if this value is "yes", you should not track the user.</li> + <li><a href="/zh-TW/docs/Web/API/Range" title="Range 介面代表一個文件的片段(fragment),可以包含節點及部分的文字節點。"><code>Range</code></a> and <a href="/zh-TW/docs/Web/API/Selection" title="The documentation about this has not yet been written; please consider contributing!"><code>Selection</code></a> objects now behave according to their specifications when <a href="/zh-TW/docs/Web/API/Text/splitText" title="The documentation about this has not yet been written; please consider contributing!"><code>splitText()</code></a> and <a href="/zh-TW/docs/Web/API/Node/normalize" title="The documentation about this has not yet been written; please consider contributing!"><code>normalize()</code></a> are called.</li> + <li>The value of <a href="/zh-TW/docs/Web/API/Node/ownerDocument" title="Node.ownerDocument 唯讀屬性會回傳一個此節點所屬的的頂層 document 物件。"><code>Node.ownerDocument</code></a> for doctype nodes is now the document on which <a href="/en-US/docs/DOM/DOMImplementation.createDocumentType" title="DOMImplementation.createDocumentType"><code>createDocumentType()</code></a> was called to create the node, instead of <code>null</code>.</li> + <li><code>window.navigator.taintEnabled</code> has been removed; it has not been supported in many years.</li> +</ul> + +<h3 id="Workers">Workers</h3> + +<ul> + <li>Workers implemented in blob URLs were broken in Firefox 8, and work again starting in Firefox 9.</li> +</ul> + +<h3 id="WebGL">WebGL</h3> + +<ul> + <li>The <a href="/en-US/docs/WebGL" title="WebGL">WebGL</a> context <code>drawingBufferWidth</code> and <code>drawingBufferHeight</code> attributes are now supported.</li> +</ul> + +<h3 id="MathML">MathML</h3> + +<ul> + <li>The non-standard <code>restyle</code> value for the <code>actiontype</code> attribute on <code><a href="/zh-TW/docs/Web/MathML/Element/maction" title="<maction>"><maction></a></code> elements has been removed.</li> + <li>While still unsupported, using the <code><a href="/zh-TW/docs/Web/MathML/Element/mlabeledtr" title="<mlabeledtr>"><mlabeledtr></a></code> element no longer breaks rendering completely. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=689641" title="Add support for mlabeledtr">bug 689641</a> for progress on actual support of this element.</li> +</ul> + +<h3 id="Networking">Networking</h3> + +<ul> + <li>You can now send the contents of <a href="/en-US/docs/JavaScript_typed_arrays" title="JavaScript typed arrays">JavaScript typed arrays</a> (that is, the contents of an <a href="/en-US/docs/JavaScript_typed_arrays/ArrayBuffer" title="ArrayBuffer"><code>ArrayBuffer</code></a> object) <a href="/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Sending_typed_arrays_as_binary_data" title="en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Sending_typed_arrays_as_binary_data">using XMLHttpRequest</a>.</li> + <li>WebSocket connections now permit non-characters in otherwise valid UTF-8 data frames to be received, instead of failing.</li> + <li>The HTTP <code>Accept</code> header for XSLT requests has been changed to simply "*/*" for simplicity. Since fetching XSLT has always fallen back to "*/*" anyway, it made sense to simplify the initial request.</li> + <li>Attempts by a server to use the <code>301 Moved Permanently</code> or <code>307 Temporary Redirect</code> response codes to redirect the user to a <code>javascript:</code> URI now <a href="/en-US/docs/HTTP#More_on_redirection_responses" title="en-US/docs/HTTP#More_on_redirection_responses">result in a "bad connection" error</a> instead of actually redirecting. This prevents certain types of cross-site scripting attacks.</li> + <li>Content served with an empty <a href="/zh-TW/docs/Web/HTTP/Headers/Content-Disposition" title="The documentation about this has not yet been written; please consider contributing!"><code>Content-Disposition</code></a> were previously treated as if the <a href="/zh-TW/docs/Web/HTTP/Headers/Content-Disposition" title="The documentation about this has not yet been written; please consider contributing!"><code>Content-Disposition</code></a> were "attachment"; this didn't always work as expected. These are now handled as if the <a href="/zh-TW/docs/Web/HTTP/Headers/Content-Disposition" title="The documentation about this has not yet been written; please consider contributing!"><code>Content-Disposition</code></a> were "inline".</li> + <li>The default maximum size of an item in the disk cache has been increased to 50 MB; previously, only items up to 5 MB were cached.</li> +</ul> + +<h3 id="Developer_tools">Developer tools</h3> + +<ul> + <li>The web console now supports basic <a href="/en-US/docs/Using_the_Web_Console#String_substitutions" title="en-US/docs/Using_the_Web_Console#String_substitutions">string substitutions</a> in its logging methods.</li> + <li>You can now <a href="/en-US/docs/Using_the_Web_Console#Using_groups_in_the_console" title="en-US/docs/Using_the_Web_Console#Using_groups_in_the_console">create visually nested blocks of output</a> in the web console, to help make it easier to read.</li> +</ul> + +<h2 id="Changes_for_Mozilla_and_add-on_developers">Changes for Mozilla and add-on developers</h2> + +<p>See <a href="/en-US/docs/Firefox/Updating_add-ons_for_Firefox_9" title="en-US/docs/Firefox/Updating add-ons for Firefox 9">Updating add-ons for Firefox 9</a> for an overview of the changes you may need to make to get your add-ons working in Firefox 9.</p> + +<h3 id="XUL">XUL</h3> + +<ul> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/tab" title="tab">tab</a></code> element now has a <code id="a-pending"><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Attribute/pending">pending</a></code> attribute, whose value is <code>true</code>, when the tab is in the process of being restored by the session store service. This can be used for styling the tab in themes. The attribute isn't present on tabs that aren't pending.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/tab" title="tab">tab</a></code> element now has an <code id="a-unread"><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Attribute/unread">unread</a></code> attribute, whose value is <code>true</code>, when the tab has changed since the last time it was the active tab or if it hasn't been selected since the current session began. The attribute isn't present on tabs that are not unread.</li> + <li>You can now use a <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/panel" title="panel">panel</a></code> as a drag image for DOM drag and drop operations. This lets you use the standard drag & drop API for <a href="/en-US/docs/DragDrop/Drag_Operations#Using_XUL_panels_as_drag_images" title="en-US/docs/DragDrop/Drag_Operations#Using_XUL_panels_as_drag_images">drag and drop of XUL content</a>.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/notificationbox" title="notificationbox">notificationbox</a></code> element's <span id="m-appendNotification"><code><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Tech/XUL/Method/appendNotification">appendNotification</a></code></span> method now lets you specify a callback that gets called for interesting events related to the notification box. Currently, the only event is "removed", which tells you the box has been removed from its window.</li> +</ul> + +<h3 id="JavaScript_code_module_changes">JavaScript code module changes</h3> + +<ul> + <li><a href="/en-US/docs/JavaScript_code_modules/FileUtils.jsm" title="FileUtils.jsm"><code>FileUtils.jsm</code></a> now has a <code>File</code> constructor that returns an <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile" title="">nsIFile</a></code> object representing a file specified by its pathname.</li> +</ul> + +<h3 id="Service_changes">Service changes</h3> + +<ul> + <li>The content preference service now <a href="/en-US/docs/Using_content_preferences#private-browsing" title="en-US/docs/Using_content_preferences#private-browsing">handles private mode browsing</a> (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=679784" title="FIXED: nsIContentPrefService should handle private browsing mode">bug 679784</a>).</li> +</ul> + +<h3 id="NSPR">NSPR</h3> + +<ul> + <li>NSPR now has an "append" module, which lets you append new data to the end of an existing log.</li> +</ul> + +<h3 id="Interface_changes">Interface changes</h3> + +<h4 id="Removed_interfaces">Removed interfaces</h4> + +<ul> + <li><code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIGlobalHistory3" title="">nsIGlobalHistory3</a></code> has been removed during streamlining of the Places and DocShell code.</li> +</ul> + +<h4 id="Miscellaneous_interface_changes">Miscellaneous interface changes</h4> + +<ul> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISound" title="">nsISound</a></code> interface has a new constant, <code>EVENT_EDITOR_MAX_LEN</code>. The allows for playing the system sound for when more characters than the maximum allowed are typed into a text field. Currently, this is only used on Windows.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIScriptError2" title="">nsIScriptError2</a></code> interface has new <code>timeStamp</code> and <code>innerWindowID</code> properties; in addition, the <code>initWithWindowID()</code> method now takes an inner window ID instead of an outer window ID.</li> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIBidiKeyboard#haveBidiKeyboards">nsIBidiKeyboard.haveBidiKeyboards</a></code> attribute has been added; this lets you determine if the system has at least one keyboard installed for each direction: left-to-right and right-to-left.</li> + <li>The new <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIEditor#isSelectionEditable">nsIEditor.isSelectionEditable</a></code> attribute lets you determine if the current selection anchor is editable. This helps to support cases where only parts of the document are editable, by letting you see if the current selection is in an editable section.</li> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIBrowserHistory#registerOpenPage()">nsIBrowserHistory.registerOpenPage()</a></code> and <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIBrowserHistory#unregisterOpenPage()">nsIBrowserHistory.unregisterOpenPage()</a></code> methods have been removed as part of a performance overhaul in the Places system. You can use the corresponding methods in <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/mozIPlacesAutoComplete" title="">mozIPlacesAutoComplete</a></code> instead.</li> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIDOMWindowUtils#wrapDOMFile()">nsIDOMWindowUtils.wrapDOMFile()</a></code> method has been added; this returns a DOM <a href="/zh-TW/docs/Web/API/File" title="File 介面提供了檔案的資訊並且允許網頁中的 JavaScript 存取檔案的內容。"><code>File</code></a> object for a given <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile" title="">nsIFile</a></code>.</li> + <li>The <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIChromeFrameMessageManager#removeDelayedFrameScript()">nsIChromeFrameMessageManager.removeDelayedFrameScript()</a></code> method was added to support removing delayed load scripts. Bootstrapped add-ons should use this, at shutdown, to remove any scripts it loaded using <code><a href="https://developer.mozilla.org/zh-TW/docs/XPCOM_Interface_Reference/nsIChromeFrameMessageManager#loadFrameScript()">nsIChromeFrameMessageManager.loadFrameScript()</a></code> with the delayed load flag set. This is exposed to add-ons as <code>browser.messageManager.removeDelayedFrameScript()</code>.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIAppStartup" title="">nsIAppStartup</a></code> interface has a new <code>interrupted</code> attribute, which lets you know if the startup process was interrupted at any point by an interactive prompt. This can be helpful, for example, when timing startups during performance evaluation, to be able to drop numbers from sessions that were interrupted.</li> + <li>The <code><a href="/zh-TW/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIEditorSpellCheck" title="">nsIEditorSpellCheck</a></code> interface has been revised to support per-site selection of spell checker dictionaries.</li> +</ul> + +<h3 id="IDL_parser">IDL parser</h3> + +<p>The IDL parser no longer includes support for the never fully-implemented notion of unique pointers.</p> + +<h3 id="Build_system_changes">Build system changes</h3> + +<ul> + <li>The <code>--enable-application=standalone</code> option for building standalone XPConnect has been removed; it hasn't worked since 2007 anyway.</li> + <li>Support for building Necko and Transformiix XSLT standalone has been removed; you can no longer use <code>--enable-application=network</code> or <code>--enable-application=content/xslt</code>.</li> + <li>The build system now looks for <code>.mozconfig</code> at <code>$topsrcdir/.mozconfig</code> or <code>$topsrcdir/mozconfig</code>, and nowhere else, unless you override the <code>.mozconfig</code> path using the <code>MOZCONFIG</code> environment variable.</li> + <li>The <code>xpidl</code> utility has been replaced in the SDK with <a href="/en-US/docs/XPIDL/pyxpidl" title="pyxpidl">pyxpidl</a>.</li> +</ul> + +<h3 id="Other_changes">Other changes</h3> + +<ul> + <li>The spell checker no longer has an arbitrary 130-character word-length limit on the length of words it will attempt to spell check. This limit was previously in place to prevent crashes that were occurring in the spell checker, but the underlying bugs have since been fixed.</li> + <li>You can now register components to add features to the <a href="/zh-TW/docs/Web/API/Window/navigator" title="The Window.navigator read-only property returns a reference to the Navigator object, which can be queried for information about the application running the script."><code>window.navigator</code></a> object by using the "JavaScript-navigator-property" category. See <a href="/en-US/docs/Developer_Guide/Adding_APIs_to_the_navigator_object" title="en-US/docs/Developer_Guide/Adding APIs to the navigator object">Adding APIs to the navigator object</a> for details and examples.</li> +</ul> + +<h2 id="See_also">See also</h2> + +<div><div class="multiColumnList"> +<ul> +<li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/8">Firefox 8 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/7">Firefox 7 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/6">Firefox 6 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/5">Firefox 5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/4">Firefox 4 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.6">Firefox 3.6 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3.5">Firefox 3.5 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/3">Firefox 3 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/2">Firefox 2 for developers</a></li><li><a href="/zh-TW/docs/Mozilla/Firefox/Releases/1.5">Firefox 1.5 for developers</a></li></ul> +</div></div> diff --git a/files/zh-tw/mozilla/firefox/releases/index.html b/files/zh-tw/mozilla/firefox/releases/index.html new file mode 100644 index 0000000000..6ef85761f2 --- /dev/null +++ b/files/zh-tw/mozilla/firefox/releases/index.html @@ -0,0 +1,12 @@ +--- +title: Firefox 各版本技術文件 +slug: Mozilla/Firefox/Releases +tags: + - Firefox + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox/Releases +--- +<div>{{FirefoxSidebar}}</div><p>這個頁面整合了 Firefox 每次釋出時的技術文件。這些文件讓您能夠清楚知道各個 Firefox 版本釋出時新增了哪些新功能及修正了哪些錯誤。</p> +<div class="multiColumnList"> + {{ListSubpages("",1,0,1)}}</div> diff --git a/files/zh-tw/mozilla/gecko/chrome/api/browser_api/index.html b/files/zh-tw/mozilla/gecko/chrome/api/browser_api/index.html new file mode 100644 index 0000000000..faa28e0f03 --- /dev/null +++ b/files/zh-tw/mozilla/gecko/chrome/api/browser_api/index.html @@ -0,0 +1,158 @@ +--- +title: Browser API +slug: Mozilla/Gecko/Chrome/API/Browser_API +translation_of: Mozilla/Gecko/Chrome/API/Browser_API/Using +--- +<p>{{ non-standard_header() }}</p> +<p>{{ B2GOnlyHeader2('privileged') }}</p> +<h2 id="摘要">摘要</h2> +<p>HTML Browser API 其實是 HTML <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 元素的延伸,可讓 Web Apps 建構瀏覽器或類似瀏覽器的 Apps。主要可分為 2 大項:</p> +<ul> + <li>針對嵌入式內容,讓 <code>iframe</code> 行為如同最上層的瀏覽器視窗。也就是說 <a href="https://developer.mozilla.org/en-US/docs/DOM/window.top" title="/en-US/docs/DOM/window.top"><code>window.top</code></a><code>、</code><a href="https://developer.mozilla.org/en-US/docs/DOM/window.parent" title="/en-US/docs/DOM/window.parent"><code>window.parent</code></a><code>、</code><a href="https://developer.mozilla.org/en-US/docs/DOM/window.frameElement" title="/en-US/docs/DOM/window.frameElement"><code>window.frameElement</code></a><code> 都不該顯示出上層的頁</code>框階層 (Frame hierarchy)。在不同情況下,也能用來說明嵌入式內容是否為 Open Web Apps。</li> + <li>用以控制並監聽嵌入式內容狀態變化的 API。</li> +</ul> +<p>另在「嵌入式內容就是 1 個 <a href="/en-US/docs/Apps" title="/en-US/docs/Apps">Open Web App</a>」的情況下,將於合適的 Apps 環境 (如權限) 中載入該內容。</p> +<h2 id="用途">用途</h2> +<p>設定了 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser">mozbrowser</a> 屬性之後,即可將 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 轉為瀏覽器框架:</p> +<pre class="brush: html"><iframe src="http://hostname.tld" mozbrowser></pre> +<p>如果要嵌入 Open Web Apps,就必須提供 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozapp">mozapp</a> 屬性,且導向 Apps 的 manifest 檔案之路徑應為:</p> +<pre><iframe src="http://hostname.tld" mozapp='http://path/to/manifest.webapp' mozbrowser></pre> +<p>最後透過 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-remote">remote</a> 屬性,<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 內容可載入至本身的子處理程序 (Child process) 中,藉以分離出「嵌入此 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 頁面」的處理程序。</p> +<pre><iframe src="http://hostname.tld" mozbrowser remote></pre> +<div class="warning"> + <p><strong>警告:</strong>因應安全考量,若要從未知/未經信任的來源下載內容,則必備最後一項屬性。若要略過此屬性,則 Apps 可能受到惡意網站的危害。</p> +</div> +<h2 id="權限">權限</h2> +<p>任何 Apps 若要嵌入瀏覽器框架,則其 <a href="/en-US/docs/Web/Apps/Manifest" title="/en-US/docs/Web/Apps/Manifest">app manifest</a> 檔案中必備 <code>browser</code> 權限。</p> +<pre class="brush: json">{ + "permissions": { + "browser": {} + } +}</pre> +<p>此外,若要嵌入 Open Web Apps,則該 App 亦需具備 <code>embed-apps</code> 權限。</p> +<pre class="brush: json">{ + "permissions": { + "browser": {}, + "embed-apps": {} + } +}</pre> +<h2 id="其他函式">其他函式</h2> +<p>為因應瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的需求,Firefox OS 另擴充了 <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement" title="/en-US/docs/Web/API/HTMLIFrameElement"><code>HTMLIFrameElement</code></a> DOM 介面。下列新函式將為 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 提供更多功能:</p> +<h3 id="存取_(Navigation)_函式">存取 (Navigation) 函式</h3> +<p>這些函式可存取 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的瀏覽記錄,為建構「停止」、「上一頁」、「下一頁」、「重新載入」等按鈕所必備。</p> +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.reload" title="/en-US/docs/Web/API/HTMLIFrameElement.reload"><code>reload()</code></a>:重新載入 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的內容。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.stop" title="/en-US/docs/Web/API/HTMLIFrameElement.stop"><code>stop()</code></a>:停止載入 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的內容。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.getCanGoBack" title="/en-US/docs/Web/API/HTMLIFrameElement.getCanGoBack"><code>getCanGoBack()</code></a>:得知是否能存取上一頁。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.goBack" title="/en-US/docs/Web/API/HTMLIFrameElement.goBack"><code>goBack()</code></a>:針對瀏覽記錄中的上個位置,更改 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的位置。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.getCanGoForward" title="/en-US/docs/Web/API/HTMLIFrameElement.getCanGoForward"><code>getCanGoForward()</code></a>:得知是否能存取下一頁。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.goForward" title="/en-US/docs/Web/API/HTMLIFrameElement.goForward"><code>goForward()</code></a>:針對瀏覽記錄中的下個位置,更改 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的位置。</li> +</ul> +<h3 id="效能函式">效能函式</h3> +<p>這些函式可管理瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 所使用的資源。特別適於建構分頁式瀏覽器的應用。</p> +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.setVisible" title="/en-US/docs/Web/API/HTMLIFrameElement.setVisible"><code>setVisible()</code></a>:更改瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的顯示狀態。如此可能影響資源分配與某些函式 (如 <a href="https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame" title="/en-US/docs/Web/API/window.requestAnimationFrame"><code>requestAnimationFrame</code></a>)。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.getVisible" title="/en-US/docs/Web/API/HTMLIFrameElement.getVisible"><code>getVisible()</code></a>:得知瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 目前的顯示狀態。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.purgeHistory" title="/en-US/docs/Web/API/HTMLIFrameElement.purgeHistory"><code>purgeHistory()</code></a>:清除瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的所有相關資源 (cookies、localStorage、快取等)。</li> +</ul> +<h3 id="事件函式">事件函式</h3> +<p>為了管理瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的內容,另新增了許多新事件 (如下所示)。下列函式即用以處理這些事件:</p> +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 現已支援 <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget" title="/en-US/docs/Web/API/EventTarget"><code>EventTarget</code></a> 介面的函式:<a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener" title="/en-US/docs/Web/API/EventTarget.addEventListener"><code>addEventListener()</code></a>、<a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.removeEventListener" title="/en-US/docs/Web/API/EventTarget.removeEventListener"><code>removeEventListener()</code></a>、<a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.dispatchEvent" title="/en-US/docs/Web/API/EventTarget.dispatchEvent"><code>dispatchEvent()</code></a>。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.sendMouseEvent" title="/en-US/docs/Web/API/HTMLIFrameElement.sendMouseEvent"><code>sendMouseEvent()</code></a>:傳送 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent" title="/en-US/docs/Web/API/MouseEvent"><code>MouseEvent</code></a> 至 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的內容。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.sendTouchEvent" title="/en-US/docs/Web/API/HTMLIFrameElement.sendTouchEvent"><code>sendTouchEvent()</code></a>:傳送 <a href="https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent" title="/en-US/docs/Web/API/TouchEvent"><code>TouchEvent</code></a> 至 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的內容。另請注意此函式僅能用於觸控式裝置。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.addNextPaintListener" title="/en-US/docs/Web/API/HTMLIFrameElement.addNextPaintListener"><code>addNextPaintListener()</code></a>:定義處理器 (Handler) 以監聽瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中的下一個 <a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/MozAfterPaint" title="/en-US/docs/Web/Reference/Events/MozAfterPaint">MozAfterPaint</a> 事件。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.removeNextPaintListener" title="/en-US/docs/Web/API/HTMLIFrameElement.removeNextPaintListener"><code>removeNextPaintListener()</code></a>:移除先前以 <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.addNextPaintListener" title="/en-US/docs/Web/API/HTMLIFrameElement.addNextPaintListener"><code>addNextPaintListener()</code></a><code> 所設定的處理器。</code></li> +</ul> +<h3 id="其他函式_2">其他函式</h3> +<p>這些函式適於使用瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的 Apps。</p> +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.getScreenshot" title="/en-US/docs/Web/API/HTMLIFrameElement.getScreenshot"><code>getScreenshot()</code></a>:針對瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的內容進行截圖。特別適合在分頁式瀏覽器 Apps 中取得分頁的圖示。</li> +</ul> +<h2 id="事件">事件</h2> +<p>若要讓 Apps 管理瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a>,則該 Apps 將監聽瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中發生的新事件。監聽的新事件如下:</p> +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowserasyncscroll" title="/en-US/docs/Web/Reference/Events/mozbrowserasyncscroll">mozbrowserasyncscroll</a>:瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中的捲動位置改變,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowserclose" title="/en-US/docs/Web/Reference/Events/mozbrowserclose">mozbrowserclose</a>:在瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中呼叫 <a href="https://developer.mozilla.org/en-US/docs/Web/API/window.close" title="/en-US/docs/Web/API/window.close"><code>window.close()</code></a>,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowsercontextmenu" title="/en-US/docs/Web/Reference/Events/mozbrowsercontextmenu">mozbrowsercontextmenu</a>:瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 嘗試開啟右鍵選單,隨即送出此函式。此函式將處理瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 內容中的可用 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menuitem"><code><menuitem></code></a> 元素。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowsererror" title="/en-US/docs/Web/Reference/Events/mozbrowsererror">mozbrowsererror</a>:在瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中載入內容而發生錯誤時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowsericonchange" title="/en-US/docs/Web/Reference/Events/mozbrowsericonchange">mozbrowsericonchange</a>:瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的網站圖示變更時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowserloadend" title="/en-US/docs/Web/Reference/Events/mozbrowserloadend">mozbrowserloadend</a>:瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 完成載入所有的外部檔案 (Assets) 時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowserloadstart" title="/en-US/docs/Web/Reference/Events/mozbrowserloadstart">mozbrowserloadstart</a>:瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 開始載入新頁面時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowserlocationchange" title="/en-US/docs/Web/Reference/Events/mozbrowserlocationchange">mozbrowserlocationchange</a>:瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 的位置改變時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowseropenwindow" title="/en-US/docs/Web/Reference/Events/mozbrowseropenwindow">mozbrowseropenwindow</a>:在瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中呼叫 <a href="https://developer.mozilla.org/en-US/docs/Web/API/window.open" title="/en-US/docs/Web/API/window.open"><code>window.open()</code></a> 時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowsersecuritychange" title="/en-US/docs/Web/Reference/Events/mozbrowsersecuritychange">mozbrowsersecuritychange</a>:在瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中變更 SSL 狀態時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowsershowmodalprompt" title="/en-US/docs/Web/Reference/Events/mozbrowsershowmodalprompt">mozbrowsershowmodalprompt</a>:在瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中呼叫 <a href="https://developer.mozilla.org/en-US/docs/Web/API/window.alert" title="/en-US/docs/Web/API/window.alert"><code>alert()</code></a>、<a href="https://developer.mozilla.org/en-US/docs/Web/API/window.confirm" title="/en-US/docs/Web/API/window.confirm"><code>confirm()</code></a>,或 <a href="https://developer.mozilla.org/en-US/docs/Web/API/window.prompt" title="/en-US/docs/Web/API/window.prompt"><code>prompt()</code></a><code> 時</code>,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowsertitlechange" title="/en-US/docs/Web/Reference/Events/mozbrowsertitlechange">mozbrowsertitlechange</a>:在瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a> 中變更 document.title 時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowserusernameandpasswordrequired" title="/en-US/docs/Web/Reference/Events/mozbrowserusernameandpasswordrequired">mozbrowserusernameandpasswordrequired</a>:請求 HTTP 的認證 (Authentification) 時,隨即送出此函式。</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mozbrowseropensearch" title="/en-US/docs/Web/Reference/Events/mozbrowseropensearch">mozbrowseropensearch</a>:只要發現搜尋引擎的鏈結,隨即送出此函式。</li> +</ul> +<h2 id="範例">範例</h2> +<p>此範例可建構最基本的瀏覽器 Apps。</p> +<h3 id="HTML">HTML</h3> +<p>在 HTML 中,我們只要新增 1 組 URL 位址列、1個「Go」與「Stop」按鈕、1 組瀏覽器 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"><code><iframe></code></a>。</p> +<pre class="brush: html"><header> + <input id="url"> + <button id="go">Go</button> + <button id="stop">Stop</button> +</header> + +<iframe src="about:blank" mozbrowser remote></iframe> +</pre> +<h3 id="CSS">CSS</h3> +<p>變個小小的 CSS 戲法,即可切換按鈕為「Go」與「Stop」。</p> +<pre class="brush: css">button:disabled { + display: none; +}</pre> +<h3 id="JavaScript">JavaScript</h3> +<p>現在可加進必要的功能:</p> +<pre class="brush: js">document.addEventListener("DOMContentLoaded", function () { + var url = document.getElementById("url"); + var go = document.getElementById("go"); + var stop = document.getElementById("stop"); + + var browser = document.getElementsByTagName("iframe")[0]; + + // This function is used to switch the Go and Stop button + // If the browser is loading content, "Go" is disabled and "Stop" is enabled + // Otherwise, "Go" is enabled and "Stop" is disabled + function uiLoading(isLoading) { + go.disabled = isLoading; + stop.disabled = !isLoading; + } + + go.addEventListener("touchend", function () { + browser.setAttribute("src", url.value); + }); + + stop.addEventListener("touchend", function () { + browser.stop(); + }); + + // When the browser starts loading content, we switch the "Go" and "Stop" buttons + browser.addEventListener('mozbrowserloadstart', function () { + uiLoading(true); + }); + + // When the browser finishes loading content, we switch back the "Go" and "Stop" buttons + browser.addEventListener('mozbrowserloadend', function () { + uiLoading(false); + }); + + // In case of error, we also switch back the "Go" and "Stop" buttons + browser.addEventListener('mozbrowsererror', function (event) { + uiLoading(false); + alert("Loading error: " + event.detail); + }); + + // When a user follows a link, we make sure the new location is displayed in the address bar + browser.addEventListener('mozbrowserlocationchange', function (event) { + url.value = event.detail; + }); +});</pre> +<h2 id="另可參閱">另可參閱</h2> +<ul> + <li>{{HTMLElement("iframe")}}</li> + <li>{{domxref("HTMLIFrameElement")}}</li> + <li><a href="https://wiki.mozilla.org/WebAPI/BrowserAPI" title="https://wiki.mozilla.org/WebAPI/BrowserAPI">WikiMo 上的建構作業</a>統計資訊</li> +</ul> diff --git a/files/zh-tw/mozilla/gecko/chrome/api/index.html b/files/zh-tw/mozilla/gecko/chrome/api/index.html new file mode 100644 index 0000000000..7c32384981 --- /dev/null +++ b/files/zh-tw/mozilla/gecko/chrome/api/index.html @@ -0,0 +1,14 @@ +--- +title: Chrome-only API reference +slug: Mozilla/Gecko/Chrome/API +translation_of: Mozilla/Gecko/Chrome/API +--- +<div>{{FirefoxSidebar}}</div> + +<p class="summary">此頁面列出了僅能在 Gecko Chrome 中執行的 APIs(and sometimes in other privileged circumstances.)。</p> + +<div class="note"> +<p><strong>Note</strong>: Most of the APIs exposed to the Web in general are also usable in Chrome code: see <a href="/en-US/docs/Web/API">Web APIs</a> for a list of these.</p> +</div> + +<p>{{SubpagesWithSummaries}}</p> diff --git a/files/zh-tw/mozilla/gecko/chrome/index.html b/files/zh-tw/mozilla/gecko/chrome/index.html new file mode 100644 index 0000000000..5701f56b12 --- /dev/null +++ b/files/zh-tw/mozilla/gecko/chrome/index.html @@ -0,0 +1,15 @@ +--- +title: Gecko Chrome +slug: Mozilla/Gecko/Chrome +tags: + - Chrome + - Gecko + - Mozilla + - Overview +translation_of: Mozilla/Gecko/Chrome +--- +<div>{{FirefoxSidebar}}</div> + +<p class="summary">此頁面包含了於 Gecko 中執行 Chrome 程式碼的相關資訊。</p> + +<p>{{SubpagesWithSummaries}}</p> diff --git a/files/zh-tw/mozilla/gecko/index.html b/files/zh-tw/mozilla/gecko/index.html new file mode 100644 index 0000000000..ce55ea402f --- /dev/null +++ b/files/zh-tw/mozilla/gecko/index.html @@ -0,0 +1,65 @@ +--- +title: Gecko +slug: Mozilla/Gecko +translation_of: Mozilla/Gecko +--- +<div class="summary"> +<p><span style="line-height: 1.5;">Gecko是一個排版引擎,一開始叫做NGLayout</span><span style="line-height: 1.5;">,屬於Mozilla專案</span><span style="line-height: 1.5;">。Gecko的功能就是讀取網頁內容,如 </span><a href="/zh-TW/docs/HTML" style="line-height: 1.5;" title="HTML">HTML</a><span style="line-height: 1.5;">, </span><a href="/zh-TW/docs/CSS" style="line-height: 1.5;" title="CSS">CSS</a><span style="line-height: 1.5;">, </span><a href="/zh-TW/docs/XUL" style="line-height: 1.5;" title="XUL">XUL</a><span style="line-height: 1.5;">, </span><a href="/zh-TW/docs/JavaScript" style="line-height: 1.5;" title="JavaScript">JavaScript</a><span style="line-height: 1.5;">,然後解析將內容顯示在螢幕上或印出來,在以XUL為基礎的應用程式中,Gecko也是用來解析生成應用程式的UI介面。</span></p> +</div> + +<p>許多應用程式中都有使用到Gecko,包括一些瀏覽器,如Firefox, SeaMonkey等等 (完整列表請參考<a class="external" href="http://en.wikipedia.org/wiki/Gecko_%28layout_engine%29#Web_browsers" rel="external" title="http://en.wikipedia.org/wiki/Gecko_(layout_engine)#Web_browsers">維基百科Gecko的文章</a>.) 。使用相同版本Gecko的程式對於標準都有著相同的支援。</p> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="文件">文件</h2> + + <dl> + <dt><a href="https://developer.mozilla.org/zh-TW/docs/Mozilla/Gecko/Chrome">Chrome</a></dt> + <dd> + <p>這個頁面包含 Gecko 運行 Chrome 專有程式碼的訊息。</p> + </dd> + </dl> + + <dl> + <dt><a href="/zh-TW/docs/Gecko_FAQ" title="Gecko_FAQ">Gecko FAQ</a></dt> + <dd>常見問題</dd> + <dt><a href="/zh-TW/docs/Gecko_DOM_Reference" title="https://developer.mozilla.org/zh-TW/docs/Gecko_DOM_Reference">Gecko DOM 參考</a></dt> + <dd>DOM參考文件</dd> + <dt><a href="/zh-TW/docs/Gecko-Specific_DOM_Events" title="Gecko/Gecko event reference">Gecko 事件參考</a></dt> + <dd>Gecko和Mozilla程式內各項事件的參考文件;對於網頁標準的DOM事件,請參考 <a href="/zh-TW/docs/DOM/DOM_event_reference" title="DOM/DOM event reference">DOM event reference</a>.</dd> + <dt><a href="/zh-TW/docs/Gecko/Versions" title="Gecko/Versions">Gecko 版本和對應的應用程式</a></dt> + <dd>Geck版本和各應用程式所用的Gecko版本列表</dd> + <dt><a class="external" href="/zh-TW/docs/Introduction_to_Layout_in_Mozilla" title="https://developer.mozilla.org/zh-TW/docs/Introduction_to_Layout_in_Mozilla">Mozilla 的排版介紹</a></dt> + <dd>排版相關的技術探討</dd> + <dt><a href="/zh-TW/docs/Embedding_Mozilla" title="Embedding_Mozilla">應用 Mozilla</a></dt> + <dd>在你自己的應用程式中使用Gecko</dd> + <dt><a href="/zh-TW/docs/Character_Sets_Supported_by_Gecko" title="Character Sets Supported by Gecko">Gecko支援的字符集</a></dt> + <dd>Gecko支援的字符集列表</dd> + <dt><a href="/zh-TW/docs/Gecko/HTML_parser_threading" title="Gecko/HTML_parser_threading">HTML 解析器運作</a></dt> + <dd>HTML解析器相關的執行緒探討</dd> + <dt>{{interwiki('wikimo', 'Gecko:Home_Page', 'Gecko Homepage on MozillaWiki')}}</dt> + <dd>使用者、產品規劃圖和最新資源的入口首頁</dd> + </dl> + + <p><span class="alllinks"><a href="/zh-TW/docs/tag/Gecko" title="tag/Gecko">全部...</a></span></p> + </td> + <td> + <h2 class="Community" id="社群">社群</h2> + + <ul> + <li>View Mozilla forums... {{DiscussionList("dev-tech-layout", "mozilla.dev.tech.layout")}}</li> + </ul> + + <h2 class="Related_Topics" id="相關主題">相關主題</h2> + + <dl> + <dd><a href="/zh-TW/docs/Web_Standards" title="Web_Standards">Web Standards</a>, <a href="/zh-TW/docs/XUL" title="XUL">XUL</a>, <a href="/zh-TW/docs/Embedding_Mozilla" title="Embedding_Mozilla">Embedding Mozilla</a>, <a href="/zh-TW/docs/Developer_Guide" title="Developing_Mozilla">Developing Mozilla</a></dd> + </dl> + </td> + </tr> + </tbody> +</table> + +<p> </p> diff --git a/files/zh-tw/mozilla/index.html b/files/zh-tw/mozilla/index.html new file mode 100644 index 0000000000..3d0e3b309f --- /dev/null +++ b/files/zh-tw/mozilla/index.html @@ -0,0 +1,11 @@ +--- +title: Mozilla +slug: Mozilla +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla +--- +<p>以下文章內容,與如何下載與組建 Mozilla 的程式碼有關。此外,也會收錄一些有助於理解程式碼如何運作、如何組建 Mozilla 程式的附加元件之類的文章。</p> + +<p>{{LandingPageListSubpages}}</p> diff --git a/files/zh-tw/mozilla/infallible_memory_allocation/index.html b/files/zh-tw/mozilla/infallible_memory_allocation/index.html new file mode 100644 index 0000000000..06844eedd5 --- /dev/null +++ b/files/zh-tw/mozilla/infallible_memory_allocation/index.html @@ -0,0 +1,84 @@ +--- +title: 絕對可靠的記憶體配置 +slug: Mozilla/Infallible_memory_allocation +tags: + - 分配 + - 記憶體 +translation_of: Mozilla/Infallible_memory_allocation +--- +<div>{{gecko_minversion_header("2.0")}}</div> + +<p>There's ongoing work to implement <strong>infallible memory allocators</strong>. These are memory allocation routines that never return <code>null</code>; that is, they always successfully return the requested block of memory. This is in contrast to a traditional, fallible memory allocator that can return <code>null</code> indicating that the request failed.</p> + +<p>Currently, while code is transitioned to be compatible with infallible memory allocators, you have to explicitly decide whether to use infallible allocation or not. Eventually, however, the generic memory allocators (<code>malloc() </code>and<code> realloc()</code>) will become infallible.</p> + +<h2 id="記憶體配置要怎樣才能萬無一失?"><a id="How can memory allocation be infallible" name="How can memory allocation be infallible"></a>記憶體配置要怎樣才能萬無一失?</h2> + +<p>「萬無一失」這個詞代表了配置記憶體時絕對會成功:你的程式碼永遠不會看到請求失敗,也就無須對失敗的情況做出處置。</p> + +<p>平常在配置記憶體時,情況則不太一樣。在有限記憶體的狀況下,記憶體配置是有可能失敗的。然而,在平常配置失敗的程序中程式將不會返回到你的程式碼中,而是直接停止程式。不過這情況可能有點少見,因為記憶體管理系統通常都會為你要求的記憶體想盡辦法找到空間。</p> + +<h2 id="選擇記憶體分配器">選擇記憶體分配器</h2> + +<p>當你在寫需要配置記憶體的程式時,可能需要遵守幾個規則以便幫助你決定是否在分配器使用萬無一失的策略:</p> + +<ul> + <li>如果你可能需要分配大塊記憶體時,你就應該讓他可能出錯(像是使用 <code>moz_malloc()</code> ,並確保返回的結果不會是 <code>null</code>。就如在 <a href="#How can memory allocation be infallible">記憶體配置要怎樣才能萬無一失?</a> 一段中所述,在有限的記憶體中要求大塊記憶體時,分配器會找不到你所要求的記憶體,因此程式會直接停止。</li> + <li>如果你不確定記憶體是否會很大塊,就使用標準的 <code>malloc()</code> 來動作,它目前是可能出錯的,但最後可能會變成萬無一失,請確認 <code>null</code> 的結果。</li> + <li>在實例物件時,<code>new</code> 這個運算元預設會萬無一失地創造他們。如果你想要讓他們有機會出錯的話,就使用 <code>new (fallible) Foo()</code> 這個語法。</li> + <li>在有疑慮的時候,使用萬無一失分配器,且不要確認 <code>null</code> 的情況。</li> + <li> + <p><code>NS_Alloc()</code> 也是萬無一失的。</p> + </li> +</ul> + +<h2 id="明示的萬無一失記憶體分配器">明示的萬無一失記憶體分配器</h2> + +<p>下面的記憶體分配器都明確地標示出他們是萬無一失的,並且會一直保持下去。他們保證會回傳可用的記憶體指標:</p> + +<pre>p = moz_xmalloc(); +p = moz_xrealloc(); +</pre> + +<pre>f = new Foo(); +fArray = new Foo[]; +</pre> + +<pre>n = ::operator new(...); +nArray = ::operator new[](...); +</pre> + +<h2 id="Explicitly_fallible_memory_allocators">Explicitly fallible memory allocators</h2> + +<p>These memory allocators are explicitly fallible, and will remain so. When using these, you must check to ensure the resulting value isn't <code>null</code> before attempting to use the returned memory.</p> + +<pre>p = moz_malloc(); +p = moz_realloc(); +</pre> + +<pre>namespace mozilla { + f = new (fallible) Foo(); + fArray = new (fallible) Foo[]; +} +</pre> + +<pre>namespace mozilla { + n = ::operator new(..., fallible); + nArray = ::operator new[](..., fallible); +} +</pre> + +<h2 id="最終萬無一失分配器">最終萬無一失分配器</h2> + +<p>下面的記憶體目前是可能出錯的,但在未來將會變成萬無一失的:</p> + +<pre>p = malloc(); +p = realloc(); +</pre> + +<h2 id="你也可以參看">你也可以參看</h2> + +<ul> + <li><a href="/en-US/docs/Choosing_the_right_memory_allocator" title="Choosing the right memory allocator">選擇正確的記憶體分配器</a></li> + <li><a href="/en-US/docs/NS_Alloc" title="NS Alloc"><code>NS_Alloc()</code></a></li> +</ul> diff --git a/files/zh-tw/mozilla/introduction_to_layout_in_mozilla/index.html b/files/zh-tw/mozilla/introduction_to_layout_in_mozilla/index.html new file mode 100644 index 0000000000..0c0c5388db --- /dev/null +++ b/files/zh-tw/mozilla/introduction_to_layout_in_mozilla/index.html @@ -0,0 +1,358 @@ +--- +title: Introduction to Layout in Mozilla +slug: Mozilla/Introduction_to_Layout_in_Mozilla +translation_of: Mozilla/Introduction_to_Layout_in_Mozilla +--- +<h2 id="Overview" name="Overview"><font><font>概要</font></font></h2> + +<ul> + <li><font><font>基本數據流</font></font></li> + <li><font><font>關鍵數據結構</font></font></li> + <li><font><font>詳細執行步驟</font></font></li> + <li><font><font>漸進模式</font></font></li> + <li><font><font>未來高科技會談</font></font></li> + <li><font><font>總結起來,Q&A</font></font></li> +</ul> + +<h2 id="Basic_Data_Flow" name="Basic_Data_Flow"><font><font>基本數據流</font></font></h2> + +<ul> + <li><font><font>通過網絡APIs 獲取源文檔</font></font></li> + <li><font><font>在單線程佈局引擎中依次執行下面步驟:</font></font> + <ul> + <li><font><font>解析,計算樣式,渲染,重複</font></font></li> + <li><font><font>CSS 用於渲染所有的內容</font></font></li> + </ul> + </li> + <li><font><font>理論上, 內容與“展示“是相分離的</font></font></li> +</ul> + +<p><img src="/files/464/Gecko_Overview_9.png" style="height: 316px; width: 688px;"></p> + +<h2 id="Key_Data_Structures" name="Key_Data_Structures"><font><font>關鍵數據結構</font></font></h2> + +<p><img src="/files/454/Gecko_Overview_10.png" style="height: 122px; width: 638px;"></p> + +<ul> + <li><font><font>內容節點</font></font> + + <ul> + <li><font><font>元素,屬性</font></font></li> + <li><font><font>判決</font></font></li> + </ul> + </li> + <li><font><font>框架(Frame)</font></font> + <ul> + <li><font><font>矩形格式</font></font></li> + <li><font><font>幾何信息</font></font></li> + <li><font><font>{{mediawiki.external('0..n')}} 每個內容節點</font></font></li> + <li><font><font>第二通第n個是“延續”</font></font></li> + </ul> + </li> + <li><font><font>樣式上下文Style context</font></font> + <ul> + <li><font><font>非幾何信息</font></font></li> + <li><font><font>可由相鄰幀共享</font></font></li> + <li><font><font>引用計數,一幀資</font></font></li> + </ul> + </li> + <li><font><font>視圖(View)</font></font> + <ul> + <li><font><font>裁剪、z 軸順序、透明度</font></font></li> + <li><font><font>{{mediawiki.external('0..1')}} 僅與一個框架 frame 對應, 從屬於框架</font></font></li> + </ul> + </li> + <li><font><font>小工具(</font></font>Widget<font><font>)</font></font> + <ul> + <li><font><font>本地窗口</font></font></li> + <li><font><font>{{mediawiki.external('0..1')}} 僅與一個視圖對應,從屬於視圖 view</font></font></li> + </ul> + </li> +</ul> + +<p><img src="/files/455/Gecko_Overview_15.png" style="height: 397px; width: 680px;"></p> + +<h2 id="Key_Data_Structures_2" name="Key_Data_Structures_2"><font><font>關鍵數據結構</font></font></h2> + +<ul> + <li><em><font><font>document</font></font></em><font><font> 物件中包含內容模型,以及一個或多個 </font></font><em><font><font>presentations</font></font></em> + + <ul> + <li><font><font>通過 DOM API 以編程方式暴露在外</font></font></li> + </ul> + </li> + <li><em><font><font>presentation</font></font></em><font><font> 包含框架層級關係</font></font> + <ul> + <li><font><font>框架包含風格背景,觀點,窗口小部件</font></font></li> + <li><font><font>演示包含的媒體類型、尺寸等</font></font></li> + <li><font><font>可能不會直接操控</font></font></li> + </ul> + </li> +</ul> + +<h2 id="Detailed_Walk-Through" name="Detailed_Walk-Through"><font><font>詳細執行步驟</font></font></h2> + +<ul> + <li><font><font>設置</font></font></li> + <li><font><font>內容模型的構建</font></font></li> + <li><font><font>框架 Frame 的構建</font></font></li> + <li><font><font>樣式 Style 的決議</font></font></li> + <li><font><font>回流(</font></font>{{Glossary("reflow")}}<font><font>)</font></font></li> + <li><font><font>繪製(</font></font>Painting<font><font>)</font></font></li> +</ul> + +<h2 id="Setting_Up" name="Setting_Up"><font><font>設置</font></font></h2> + +<ul> + <li><font><font>假設此處您已經熟悉嵌入和網路 API(doc shell、stream)的基本知識。</font></font></li> + <li><font><font>Content DLL 自動註冊一個<em>文件載入工廠(</em></font></font><em><font><font>DLF)</font></font></em> + <ul> + <li><code>@mozilla.org/content-viewer-factory/view;1?type=text/html</code></li> + <li><font><font>所有 MIME type 都與同一個類——nsContentDLF 相對應</font></font></li> + </ul> + </li> + <li><code><font><font>nsDocShell</font></font></code> + <ul> + <li><font><font>通過 </font></font><code><font><font>nsDSURIContentListener</font></font></code><font><font> 接收穫取的內容(原始數據)</font></font></li> + <li><font><font>呼叫 </font></font><code><font><font>nsIDLF::CreateInstance</font></font></code><font><font> 方法,傳遞 MIME type 給 DLF</font></font></li> + </ul> + </li> + <li><font><font>nsContentDLF</font></font> + <ul> + <li><font><font>建立一個 </font></font><code><font><font>nsHTMLDocument</font></font></code><font><font> 物件,呼叫 </font></font><code><font><font>StartDocumentLoad</font></font></code> + <ul> + <li><font><font>建立一個解析器(parser),將 </font></font><code><font><font>nsIStreamListener</font></font></code><font><font> 物件返回給 docshell</font></font></li> + <li><font><font>創建一個 content sink(它會將解析器 parser 與文件 doucment 相連接)</font></font></li> + </ul> + </li> + <li><font><font>創建一個 </font></font><code><font><font>DocumentViewerImpl</font></font></code><font><font> 對象,將 </font></font><code><font><font>nsIContentViewer</font></font></code><font><font> 對象返回給 docshell</font></font></li> + </ul> + </li> + <li><code><font><font>DocumentViewerImpl</font></font></code><font><font> 創建 pres context 和 pres shell</font></font></li> +</ul> + +<p><img src="/files/456/Gecko_Overview_19.png" style="height: 350px; width: 663px;"></p> + +<h2 id="Content_Model_Construction" name="Content_Model_Construction"><font><font>內容模型的構建</font></font></h2> + +<ul> + <li><font><font>從網絡上通過 </font></font><code><font><font>nsIStreamListener::OnDataAvailable</font></font></code><font><font> 獲取內容</font></font></li> + <li><font><font>解析器對內容進行標記&處理;使用 </font></font><em><font><font>parser node</font></font></em><font><font> 對像在</font></font><code><font><font> nsIContentSink</font></font></code><font><font> 上調用方法</font></font> + <ul> + <li><font><font>一些緩衝和修正發生在這裡</font></font></li> + <li><font><code><font>OpenContainer,CloseContainer,AddLeaf</font></code></font></li> + </ul> + </li> + <li><font><font>內容水槽創建並使用附加內容節點 </font></font><code><font><font>nsIContent</font></font></code><font><font> 接口</font></font> + <ul> + <li><font><font>內容水槽保持棧的“活”元素</font></font></li> + <li><font><font>更多緩衝和修正發生在這裡</font></font></li> + <li><font><code><font>InsertChildAt,AppendChildTo,RemoveChildAt</font></code></font></li> + </ul> + </li> +</ul> + +<p><img src="/files/457/Gecko_Overview_21.png" style="height: 179px; width: 662px;"></p> + +<h2 id="Frame_Construction" name="Frame_Construction"><font><font>框架 Frame 的構建</font></font></h2> + +<ul> + <li><font><font>內容接收器使用 </font></font><code><font><font>nsIDocument</font></font></code><font><font>接口,在內容模型通知ΔS的</font></font> + + <ul> + <li><font><code><font>ContentAppended,ContentInserted,ContentRemoved</font></code></font></li> + </ul> + </li> + <li><code><font><font>PresShell</font></font></code><font><font> 被註冊作為文件觀察者</font></font> + <ul> + <li><font><font>接收 </font></font><code><font><font>ContentAppended</font></font></code><font><font> 等通知</font></font></li> + <li><font><font>它傳遞給樣式集的對象,誰又將傳遞給幀構造</font></font></li> + </ul> + </li> + <li><font><font>框架構造函數創建幀</font></font> + <ul> + <li><code><font><font>ConstructFrameInternal</font></font></code><font><font> 遞歸散步內容樹,解決作風和創建幀</font></font></li> + <li><font><font>或者通過標籤創建</font></font><code><font><font>(</font></font><select><font><font>)</font></font></code><font><font>或顯示類型</font><font>(</font></font><code><p></code><font><font>)</font></font></li> + </ul> + </li> + <li><font><font>幀管理者保持映射從內容到框架</font></font></li> +</ul> + +<p><img src="/files/458/Gecko_Overview_23.png" style="height: 359px; width: 697px;"></p> + +<h2 id="Style_Resolution" name="Style_Resolution"><font><font>Style 選定</font></font></h2> + +<ul> + <li><font><font>計算依據適用於框架的內容節點樣式規則文體信息</font></font></li> + <li><font><font>分成不同的結構樣式數據</font></font> + <ul> + <li><font><font>顯示,能見度,字體,顏色,背景,...</font></font></li> + <li><font><font>繼承與復位</font></font></li> + </ul> + </li> + <li><font><font>樣式上下文對象是一個佔位符部分計算文體數據</font></font> + <ul> + <li><font><font>樣式數據懶洋洋地計算,因為它要求</font></font></li> + </ul> + </li> +</ul> + +<h2 id="Reflow" name="Reflow"><font><font>回流</font></font></h2> + +<ul> + <li><font><font>遞歸計算幾何</font><em><font>(</font></em></font><em>x</em>,<em>y</em>,<em>w</em>,<em>h</em><font><em><font>)</font></em><em><font>為框架,視圖和小部件</font></em></font> + + <ul> + <li><font><font>鑑於“根幀”計算(</font></font><em>x</em>,<em>y</em>,<em>w</em>,<em>h</em><font><em><font>)為所有兒童</font></em></font></li> + <li><font><font>通過約束傳播“向下</font></font><code><font><font>”nsHTMLReflowState</font></font></code></li> + <li><font><font>所需的大小返回“向上”通過</font></font><code><font><font>nsHTMLReflowMetrics</font></font></code></li> + </ul> + </li> + <li><font><font>基本模式</font></font> + <ul> + <li><font><font>父框架初始化子回流狀態(可</font><em><font>W¯¯,^ </font></em><font>h); </font><font>地方子幀</font><font>(x,ÿ); </font><font>調用孩子的</font><code><font>回流</font></code><font>方法</font></font></li> + <li><font><font>子幀計算所需的</font><em><font>(W¯¯,^</font></em><font> </font><em><font>h),通過回流焊指標回報</font></em></font></li> + <li><font><font>家長外形尺寸為子框架和觀點的基礎上孩子的指標</font></font></li> + </ul> + </li> + <li><font><font>注:很多</font></font><em><font><font>並不</font></font></em><font><font>這樣工作!</font><font>(表,塊,XUL盒)</font></font></li> +</ul> + +<h2 id="Reflow_2" name="Reflow_2"><font><font>回流</font></font></h2> + +<ul> + <li><font><font>“環球”回流</font></font> + + <ul> + <li><em><font><font>最初,調整大小,風格變化</font></font></em></li> + <li><font><font>通過立即處理</font></font><code><font><font>PresShell</font></font></code><font><font>方法</font></font></li> + </ul> + </li> + <li><font><font>增量回流</font></font> + <ul> + <li><font><font>針對特定的幀</font></font></li> + <li><em><font><font>臟</font></font></em><font><font>,</font></font><em><font><font>內容改變</font></font></em><font><font>,</font></font><em><font><font>風格改變了</font></font></em><font><font>,</font></font><em><font><font>用戶自定義</font></font></em></li> + <li><code><font><font>nsHTMLReflowCommand</font></font></code><font><font>對象封裝信息</font></font></li> + <li><font><font>排隊和異步處理</font></font><code><font><font>,nsIPressShell </font><font>:: </font></font></code><code><font><font>AppendReflowCommand,ProcessReflowCommands</font></font></code></li> + </ul> + </li> +</ul> + +<h2 id="Incremental_Reflow" name="Incremental_Reflow"><font><font>增量回流</font></font></h2> + +<p><img src="/files/459/Gecko_Overview_28.png" style="height: 331px; width: 319px;"></p> + +<ul> + <li><font><font>遞歸下降到目標</font></font><em><font><font>恢復回流狀態</font></font></em> + + <ul> + <li><font><font>兒童rs.reason設置為</font></font><em><font><font>增量</font></font></em></li> + </ul> + </li> +</ul> + +<h2 id="Incremental_Reflow_2" name="Incremental_Reflow_2"><font><font>增量回流</font></font></h2> + +<p><img src="/files/460/Gecko_Overview_29.png" style="height: 331px; width: 319px;"></p> + +<ul> + <li><font><font>流程回流“正常”的目標框架</font></font> + + <ul> + <li><font><font>兒童rs.reason一套基於RC的</font></font><em><font><font>類型</font></font></em></li> + </ul> + </li> +</ul> + +<h2 id="Incremental_Reflow_3" name="Incremental_Reflow_3"><font><font>增量回流</font></font></h2> + +<p><img src="/files/461/Gecko_Overview_30.png" style="height: 332px; width: 319px;"></p> + +<ul> + <li><em><font><font>傳播損害</font></font></em><font><font>到“在流動”幀之後</font></font></li> +</ul> + +<h2 id="Incremental_Reflow_4" name="Incremental_Reflow_4"><font><font>增量回流</font></font></h2> + +<p><img src="/files/462/Gecko_Overview_31.png" style="height: 331px; width: 319px;"></p> + +<ul> + <li><font><font>多次回流焊命令批處理</font></font> + + <ul> + <li><code><font><font>nsReflowPath</font></font></code><font><font>維持目標幀的一棵樹</font></font></li> + <li><font><font>攤銷狀態的恢復和損傷擴展成本</font></font></li> + </ul> + </li> +</ul> + +<h2 id="Painting" name="Painting"><font><font>繪畫</font></font></h2> + +<ul> + <li><font><font>當回流繼續通過幀層次結構,區域</font></font><em><font><font>無效</font></font></em><font><font>通過</font></font><code><font><font>nsIViewManager ::更新視圖</font></font></code></li> + <li><font><font>除非</font></font><em><font><font>直接</font></font></em><font><font>的,無效的區域合併,並通過操作系統的異步處理</font></font><em><font><font>揭露</font></font></em><font><font>事件</font></font></li> + <li><font><font>本機暴露事件分派到小部件; </font><font>小部件委託給視圖管理器</font></font></li> + <li><font><font>查看經理描繪的意見後到前,調用</font></font><code><font><font>PresShell</font></font></code><font><font>的</font></font><code><font><font>畫圖</font></font></code><font><font>方法</font></font></li> + <li><code><font><font>PresShell ::油漆</font></font></code><font><font>遍歷從視圖幀; </font><font>將調用</font></font><code><font><font>nsIFrame ::油漆</font></font></code><font><font>每個</font></font><em><font><font>層</font></font></em></li> +</ul> + +<h2 id="Incrementalism" name="Incrementalism"><font><font>漸進</font></font></h2> + +<ul> + <li><font><font>單線程</font></font> + + <ul> + <li><font><font>簡單(無鎖)</font></font></li> + <li><font><font>不能離開事件隊列無人值守</font></font></li> + </ul> + </li> + <li><font><font>內容建設開卷“隨意”</font></font> + <ul> + <li><font><font>解析器和內容接收器做一些緩衝</font></font></li> + <li><font><font>內容散熱器具有“通知限制”</font></font></li> + <li><font><font>效率與響應速度的權衡</font></font></li> + </ul> + </li> + <li><font><font>框架結構運行完成</font></font></li> + <li><font><font>CSS解析運行完成</font></font></li> + <li><font><font>回流焊運行完成(主要)</font></font></li> + <li><font><font>繪畫運行完成</font></font></li> +</ul> + +<p><img src="/files/463/Gecko_Overview_34.png" style="height: 380px; width: 694px;"></p> + +<h2 id="Future_.28.3F.29_Tech_Talks" name="Future_.28.3F.29_Tech_Talks"><font><font>未來(?)技術講座</font></font></h2> + +<ul> + <li><font><font>內容模型和DOM - </font><em><font>JST,jkeiser</font></em></font></li> + <li><font><font>解析器和內容接收器(ESP無效的內容) - </font></font><em><font><font>harishd</font></font></em></li> + <li><font><font>事件- </font></font><em><font><font>薩里</font></font></em><font><font>,</font></font><em><font><font>條既納</font></font></em></li> + <li><font><font>塊和行回流焊- </font><em><font>沃特森,dbaron</font></em></font></li> + <li><font><font>表回流焊- </font></font><em><font><font>karnaze</font></font></em></li> + <li><font><font>窗體控件- </font><em><font>棒,礪石</font></em></font></li> + <li><font><font>風格解析和規則樹- </font></font><em><font><font>dbaron</font></font></em></li> + <li><font><font>視圖,窗口小部件,和繪畫- </font></font><em><font><font>大鵬</font></font></em><font><font> </font></font><em><font><font>,kmcclusk</font></font></em></li> + <li><font><font>編輯器- </font><em><font>健,Jfrancis</font></em></font></li> + <li><font><font>XUL和箱的佈局- </font></font><em><font><font>休伊特</font></font></em><font><font>,</font></font><em><font><font>本</font></font></em></li> + <li><font><font>XBL - </font></font><em><font><font>休伊特</font></font></em><font><font>,</font></font><em><font><font>本</font></font></em></li> +</ul> + +<h2 id="Conclusion" name="Conclusion"><font><font>結論</font></font></h2> + +<ul> + <li><font><font>數據流</font></font></li> + <li><font><font>關鍵數據結構</font></font></li> + <li><font><font>詳細演練</font></font></li> + <li><font><font>漸進</font></font></li> + <li><font><font>Q&A?</font></font></li> +</ul> + +<div class="originaldocinfo"> +<h2 id="Original_Document_Information" name="Original_Document_Information"><font><font>原始文檔信息</font></font></h2> + +<ul> + <li><a class="link-mailto" href="mailto:waterson@netscape.com"><font><font>作者(S):克里斯·沃特森</font></font></a></li> + <li><font><font>最後更新日期:2002年6月10日,</font></font></li> + <li><font><font>版權信息:此內容的部分是©1998-2008個別mozilla.org貢獻者; </font><font>|在創作共用許可的可用內容</font></font><a href="http://www.mozilla.org/foundation/licensing/website-content.html"><font><font>詳細信息</font></font></a><font><font>。</font></font></li> +</ul> +</div> diff --git a/files/zh-tw/mozilla/javascript_code_modules/index.html b/files/zh-tw/mozilla/javascript_code_modules/index.html new file mode 100644 index 0000000000..72f737df9e --- /dev/null +++ b/files/zh-tw/mozilla/javascript_code_modules/index.html @@ -0,0 +1,102 @@ +--- +title: JavaScript code modules +slug: Mozilla/JavaScript_code_modules +tags: + - Add-ons + - Extensions + - JavaScript + - Landing + - Modules + - NeedsTranslation + - TopicStub + - XPCOM +translation_of: Mozilla/JavaScript_code_modules +--- +<div>{{gecko_minversion_header("1.9")}}</div> + +<p>JavaScript code modules let multiple privileged JavaScript scopes share code. For example, a module could be used by Firefox itself as well as by extensions, in order to avoid code duplication.</p> + +<h2 id="General_topics">General topics</h2> + +<dl style="-moz-columns: 2; columns: 2;"> + <dt><a href="/en-US/docs/JavaScript_code_modules/Using" title="./Using">Using JavaScript code modules</a></dt> + <dd>An introduction to how to use JavaScript code modules.</dd> + <dt><a href="/en-US/docs/Components.utils.import" title="Components.utils.import">Components.utils.import</a></dt> + <dd>How to import a JavaScript code module.</dd> + <dt><a href="/en-US/docs/Components.utils.unload" title="Components.utils.unload">Components.utils.unload</a> {{gecko_minversion_inline("7.0")}}</dt> + <dd>How to unload a JavaScript code module.</dd> + <dt><a href="/en-US/docs/Code_snippets/Modules" title="Code_snippets/Modules">Code snippets: Modules</a></dt> + <dd>Examples of how to use code modules.</dd> + <dt><a class="external" href="http://wiki.mozilla.org/Labs/JS_Modules">Mozilla Labs JS Modules</a></dt> + <dd>This page features a list of JS modules, along with download links and documentation, that extension developers can use in their code.</dd> +</dl> + +<dl> +</dl> + +<h2 id="Standard_code_modules">Standard code modules</h2> + +<dl style="-moz-columns: 2; columns: 2;"> + <dt><a href="/en-US/docs/Addons/Add-on_Manager" title="Addons/Add-on_Manager">AddonManager.jsm</a> {{gecko_minversion_inline("2.0")}}</dt> + <dd>Interface to install, manage, and uninstall add-ons.</dd> + <dt><a href="/en-US/docs/Addons/Add-on_Repository" title="Addons/Add-on Repository">AddonRepository.jsm</a> {{gecko_minversion_inline("2.0")}}</dt> + <dd>Allows searching of the add-ons repository.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Assert.jsm" title="./Assert.jsm">Assert.jsm</a> {{gecko_minversion_inline("28.0")}}</dt> + <dd>Implements the <a href="http://wiki.commonjs.org/wiki/Unit_Testing/1.1" title="http://wiki.commonjs.org/wiki/Unit_Testing/1.1">CommonJS Unit Testing specification version 1.1</a>, which provides a basic, standardized interface for performing in-code logical assertions with optional, customizable error reporting.</dd> + <dt><a href="/en-US/docs/Mozilla/js-ctypes" title="./ctypes.jsm">ctypes.jsm</a> {{fx_minversion_inline("3.6")}}</dt> + <dd>Provides an interface that allows JavaScript code to call native libraries without requiring the development of an XPCOM component.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm" title="./ctypes.jsm">CustomizableUI.jsm</a> {{fx_minversion_inline("29")}}</dt> + <dd>Allows you to interact with customizable buttons and items in Firefox's main window UI.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/DeferredTask.jsm" title="./DeferredTask.jsm">DeferredTask.jsm</a> {{gecko_minversion_inline("18.0")}}</dt> + <dd>Run a task after a delay.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Dict.jsm" title="./Dict.jsm">Dict.jsm</a> {{gecko_minversion_inline("5.0")}}</dt> + <dd>Provides an API for key/value pair dictionaries.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/DownloadLastDir.jsm" title="./DownloadLastDir.jsm">DownloadLastDir.jsm</a> {{gecko_minversion_inline("2.0")}}</dt> + <dd>Provides the path to the directory into which the last download occurred.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm" title="./Downloads.jsm">Downloads.jsm</a> {{gecko_minversion_inline("23.0")}}</dt> + <dd>Provides a single entry point to interact with the downloading capabilities of the platform.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/FileUtils.jsm" title="./FileUtils.jsm"><strong style="font-weight: bold;">FileUtils.jsm</strong></a> {{gecko_minversion_inline("1.9.2")}}</dt> + <dd>Provides helpers for dealing with files.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Geometry.jsm" title="./Geometry.jsm">Geometry.jsm</a> {{gecko_minversion_inline("2.0")}}</dt> + <dd>Provides routines for performing basic geometric operations on points and rectangles.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Geometry.jsm" title="./Geometry.jsm">HTTP.jsm</a> {{gecko_minversion_inline("25.0")}}</dt> + <dd>A wrapper for XMLHttpRequest that provides convenient and simplified API for dealing with HTTP requests.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/JNI.jsm">JNI.jsm</a> {{fx_minversion_inline("17.0")}}</dt> + <dd>Abstracts the js-ctypes to provide an interface that allows JavaScript code to call code running in native JVMs.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/ISO8601DateUtils.jsm" title="./ISO8601DateUtils.jsm">ISO8601DateUtils.jsm</a></dt> + <dd>Provides routines to convert between JavaScript <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Date" title="JavaScript/ Reference/Global Objects/Date"><code>Date</code></a> objects and ISO 8601 date strings.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Log.jsm">Log.jsm</a> (formerly log4moz) {{gecko_minversion_inline("27.0")}}</dt> + <dd>Provides a <a href="https://en.wikipedia.org/wiki/Log4j">log4j</a> style API for logging log messages to various endpoints, such as the <a href="/en-US/docs/Tools/Browser_Console">Browser Console</a> or a file on disk. This module was formerly</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/NetUtil.jsm" title="./NetUtil.jsm"><strong style="font-weight: bold;">NetUtil.jsm</strong></a></dt> + <dd>Provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asynchronously.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/openLocationLastURL.jsm" title="./openLocationLastURL.jsm">openLocationLastURL.jsm</a> {{gecko_minversion_inline("1.9.1.4")}}</dt> + <dd>Provides access to the last URL opened using the "Open Location" option in the File menu.</dd> + <dt><a href="/Mozilla/JavaScript_code_modules/OSFile.jsm" title="/en-US/docs/JavaScript_OS.File">OSFile.jsm</a> {{gecko_minversion_inline("16.0")}}</dt> + <dd>Provides routines to access files. Read, write, rename, create directories, ...</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/PerfMeasurement.jsm" title="./PerfMeasurement.jsm">PerfMeasurement.jsm</a> {{fx_minversion_inline("4.0")}}</dt> + <dd>Provides access to low-level hardware and OS performance measurement tools.</dd> + <dt><a href="/en-US/docs/Localization_and_Plurals" title="Localization and Plurals">PluralForm.jsm</a></dt> + <dd>Provides an easy way to get the correct plural forms for the current locale, as well as ways to localize to a specific plural rule.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/PopupNotifications.jsm" title="./PopupNotifications.jsm">PopupNotifications.jsm</a> {{gecko_minversion_inline("2.0")}}</dt> + <dd>Provides an easy way to present non-modal notifications to users.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm" title="./Promise.jsm">Promise.jsm</a> {{gecko_minversion_inline("25.0")}}</dt> + <dd>Implements the <a class="external" href="https://github.com/promises-aplus/promises-spec/blob/1.0.0/README.md" title="https://github.com/promises-aplus/promises-spec/blob/1.0.0/README.md">Promises/A+</a> proposal as known in April 2013.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/PromiseWorker.jsm">PromiseWorker.jsm</a> {{gecko_minversion_inline("20.0")}}</dt> + <dd>A version of {{domxref("ChromeWorker")}} which uses promises to return the worker's result instead of using an event to do so.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Services.jsm" title="./Services.jsm">Services.jsm</a> {{gecko_minversion_inline("2.0")}}</dt> + <dd>Provides getters for conveniently obtaining access to commonly-used services.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/source-editor.jsm" title="./source-editor.jsm">source-editor.jsm</a> {{fx_minversion_inline("11.0")}}</dt> + <dd>The Source Editor is used by developer tools such as the Style Editor; this interface implements the editor and lets you interact with it.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Sqlite.jsm" title="./Sqlite.jsm">Sqlite.jsm</a> {{gecko_minversion_inline("20.0")}}</dt> + <dd>A Promise-based API to {{ interface("mozIStorage") }}/SQLite.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Task.jsm" title="./Task.jsm">Task.jsm</a> {{gecko_minversion_inline("17.0")}}</dt> + <dd>Implements a subset of <a class="external" href="http://taskjs.org/" title="http://taskjs.org/">Task.js</a> to make sequential, asynchronous operations simple, using the power of JavaScript's <code>yield</code> operator.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Timer.jsm" title="/en-US/docs/Mozilla/JavaScript_code_modules/Timer.jsm">Timer.jsm </a>{{gecko_minversion_inline("22.0")}}</dt> + <dd>A pure JS implementation of <code>window.setTimeout</code>.</dd> + <dt><a href="/en-US/Add-ons/Webapps.jsm" title="/en-US/docs/Mozilla/JavaScript_code_modules/Timer.jsm">Webapps.jsm </a>{{gecko_minversion_inline("??.0")}}</dt> + <dd>Provides an interface to manager Open Web Apps.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/WebRequest.jsm">WebRequest.jsm</a> {{gecko_minversion_inline("41.0")}}</dt> + <dd>Provides an API to add event listeners for the various stages of making an HTTP request. The event listener receives detailed information about the request, and can modify or cancel the request.</dd> + <dt><a href="/en-US/docs/Mozilla/JavaScript_code_modules/XPCOMUtils.jsm" title="./XPCOMUtils.jsm">XPCOMUtils.jsm</a></dt> + <dd>Contains utilities for JavaScript components loaded by the JS component loader.</dd> +</dl> diff --git a/files/zh-tw/mozilla/javascript_code_modules/promise.jsm/index.html b/files/zh-tw/mozilla/javascript_code_modules/promise.jsm/index.html new file mode 100644 index 0000000000..fc54b6e846 --- /dev/null +++ b/files/zh-tw/mozilla/javascript_code_modules/promise.jsm/index.html @@ -0,0 +1,144 @@ +--- +title: Promise.jsm +slug: Mozilla/JavaScript_code_modules/Promise.jsm +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/JavaScript_code_modules/Promise.jsm +--- +<p>{{ gecko_minversion_header("25") }}</p> + +<p>The <code>Promise.jsm</code> JavaScript code module implements the <a href="https://github.com/promises-aplus/promises-spec/blob/1.0.0/README.md" title="https://github.com/promises-aplus/promises-spec/blob/1.0.0/README.md">Promises/A+</a> proposal as known in April 2013.</p> + +<div class="warning"> +<p>This module was used before <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">DOM Promises</a> were made globally available in Gecko 29. Its usage is not suggested for new code.</p> + +<p>If you just need a Promise, consider using a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">DOM Promise</a> instead.</p> + +<p>If you need a <a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred">Deferred</a>, because you want to create a Promise and manually resolve or reject it, consider using <a href="/en-US/docs/Mozilla/JavaScript_code_modules/PromiseUtils.jsm">PromiseUtils.jsm</a> instead.</p> +</div> + +<p>To use it, you first need to import the code module into your JavaScript scope:</p> + +<pre>Components.utils.import("resource://gre/modules/Promise.jsm"); +</pre> + +<div class="note"> +<p><strong>Note:</strong> A preliminary promise module is also available starting from Gecko 17, though it didn't conform to the Promises/A+ proposal until Gecko 25:</p> + +<pre>Components.utils.import("<s>resource://gre/modules/commonjs/promise/core.js</s>"); // Gecko 17 to 20 +Components.utils.import("<s>resource://gre/modules/commonjs/sdk/core/promise.js</s>"); // Gecko 21 to 24 +</pre> + +<p>This implementation also includes helper functions that are specific to the Add-on SDK. While you may still import this module from the above paths, the recommended way for loading it is through the <a href="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/toolkit/loader.html" title="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/toolkit/loader.html">Add-on SDK loader</a>.</p> +</div> + +<h2 id="Introduction">Introduction</h2> + +<p>For an introduction to promises, you may start from the <a href="/en-US/Add-ons/SDK/Low-Level_APIs/core_promise">Add-on SDK documentation</a>, keeping in mind that only the core subset is implemented in this module.</p> + +<p><u>A promise is an object representing a value that may not be available yet</u>. Internally, a promise can be in one of three states:</p> + +<ul> + <li><strong>Pending</strong>, when the final value is not available yet. This is the only state that may transition to one of the other two states.</li> + <li><strong>Fulfilled</strong>, when and if the final value becomes available. A <em>fulfillment value</em> becomes permanently associated with the promise. This may be any value, including <code>undefined</code>.</li> + <li><strong>Rejected</strong>, if an error prevented the final value from being determined. A <em>rejection reason</em> becomes permanently associated with the promise. This may be any value, including <code>undefined</code>, though it is generally an <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Error" title="/en-US/docs/JavaScript/Reference/Global_Objects/Error"><code>Error</code></a> object, like in exception handling.</li> +</ul> + +<p>A reference to an existing promise may be received by different means, for example as the return value of a call into an asynchronous API. In this case, the state of the promise can be observed but not directly controlled.</p> + +<p>To observe the state of a promise, its <code>then</code> method must be used. This method registers callback functions that are called as soon as the promise is either fulfilled or rejected. The method returns a new promise, that in turn is fulfilled or rejected depending on the state of the original promise and on the behavior of the callbacks. For example, unhandled exceptions in the callbacks cause the new promise to be rejected, even if the original promise is fulfilled. See the documentation of the <code>then</code> method for details.</p> + +<p>Promises may also be created using the <a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise#Constructor" title="/Mozilla/JavaScript_code_modules/Promise.jsm/Promise#Constructor"><code>new Promise()</code></a> constructor.</p> + +<h2 id="Method_overview">Method overview</h2> + +<table class="standard-table"> + <tbody> + <tr> + <td><code><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred">Deferred</a> <a href="#defer()">defer</a>();</code> {{ obsolete_inline("30") }}</td> + </tr> + <tr> + <td><code><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise">Promise</a> <a href="#resolve()">resolve</a>([optional] aValue);</code></td> + </tr> + <tr> + <td><code><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise">Promise</a> <a href="#reject()">reject</a>([optional] aReason);</code></td> + </tr> + </tbody> +</table> + +<h2 id="Methods">Methods</h2> + +<h3 id="defer()">defer()</h3> + +<p>Creates a new pending promise and provides methods to resolve or reject it.</p> + +<pre>Deferred defer(); {{ obsolete_inline("30") }} +</pre> + +<h6 id="Parameters">Parameters</h6> + +<p>None.</p> + +<h6 id="Return_value">Return value</h6> + +<p>A new object, containing the new promise in the <code>promise</code> property, and the methods to change its state in the <code>resolve</code> and <code>reject</code> properties. See the <a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred"><code>Deferred</code></a> documentation for details.</p> + +<h3 id="resolve()">resolve()</h3> + +<p>Creates a new promise fulfilled with the specified value, or propagates the state of an existing promise.</p> + +<pre>Promise resolve( + aValue +); +</pre> + +<h6 id="Parameters_2">Parameters</h6> + +<dl> + <dt><code>aValue</code> {{ optional_inline() }}</dt> + <dd>If this value is not a promise, including <code>undefined</code>, it becomes the fulfillment value of the returned promise. If this value is a promise, then the returned promise will be resolved with the value, i.e. it will eventually assume the same state as the provided promise.</dd> +</dl> + +<h6 id="Return_value_2">Return value</h6> + +<p>A promise that can be pending, fulfilled, or rejected.</p> + +<h3 id="reject()">reject()</h3> + +<p>Creates a new promise rejected with the specified reason.</p> + +<pre>Promise reject( + aReason +); +</pre> + +<h6 id="Parameters_3">Parameters</h6> + +<dl> + <dt><code>aReason</code> {{ optional_inline() }}</dt> + <dd> + <p>The rejection reason for the returned promise. Although the reason can be <code>undefined</code>, it is generally an <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Error" title="/en-US/docs/JavaScript/Reference/Global_Objects/Error"><code>Error</code></a> object, like in exception handling.</p> + + <div class="note"><strong>Note:</strong> This argument should not be a promise. Specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.</div> + </dd> +</dl> + +<h6 id="Return_value_3">Return value</h6> + +<p>A rejected promise.</p> + +<h2 id="Examples">Examples</h2> + +<p>See the <a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Examples">examples</a> page.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise">Promise</a></li> + <li><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred">Deferred</a></li> + <li><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Examples">Examples</a></li> + <li><a class="internal" href="/en-US/docs/JavaScript_code_modules/Using" title="en-US/docs/JavaScript code modules/Using JavaScript code modules">Using JavaScript code modules</a></li> + <li><a class="internal" href="/en-US/docs/Mozilla/JavaScript_code_modules" title="en-US/docs/Mozilla/JavaScript code modules">JavaScript code modules</a></li> + <li><a class="internal" href="/en-US/docs/Components.utils.import" title="en-US/docs/Components.utils.import"><code>Components.utils.import</code></a></li> +</ul> diff --git a/files/zh-tw/mozilla/javascript_code_modules/promise.jsm/promise/index.html b/files/zh-tw/mozilla/javascript_code_modules/promise.jsm/promise/index.html new file mode 100644 index 0000000000..44c0b22181 --- /dev/null +++ b/files/zh-tw/mozilla/javascript_code_modules/promise.jsm/promise/index.html @@ -0,0 +1,215 @@ +--- +title: Promise +slug: Mozilla/JavaScript_code_modules/Promise.jsm/Promise +tags: + - JavaScript + - Promise.jsm +translation_of: Mozilla/JavaScript_code_modules/Promise.jsm/Promise +--- +<p><strong>一個 <code>Promise</code> 物件代表一個可能還不能使用的值。</strong></p> + +<p>可以用不同的方式接收一個 promise 的參照,比如作為一個異步 API 的回傳值。一但你有了 promise 的參照,你就可以呼叫它的 <a href="#then()" title="#then()"><code>then()</code></a> 方法來在它的值準備好後,或是,當錯誤發生時執行一些動作。</p> + +<p>Promises 物件也可以透過 <a href="#Constructor" title="#Constructor"><code>new Promise()</code></a> 建構子來創建。當你使用一個 <code>Promise</code> 物件的參照時,並不需要額外引入 <code>Promise.jsm</code> 模組 。</p> + +<p>一個 promise 可以處於三種內部狀態:</p> + +<ul> + <li><strong>Pending</strong>, 當最終的值尚未準備好被使用時。這是唯一一個可以轉移到其他兩個狀態的狀態。</li> + <li><strong>Fulfilled</strong>, 當最終的值準備好被使用時。一個完成值將和 promise 建立永久關聯。它可能是任意的值,包和 <code>undefined</code>。</li> + <li><strong>Rejected</strong>, 當計算最終的值時有錯誤發生。一個拒絕原因將和 promise 建立永久關聯。它可以是任意的值,包含 <code>undefined</code>,儘管它通常是一個 <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error" title="/en-US/docs/JavaScript/Reference/Global_Objects/Error"><code>Error</code></a> 物件對象,就像例外處理時一樣。</li> +</ul> + +<div class="note"> +<p><strong>註:</strong> 你永遠應該處理、轉送或是回報錯誤(或是拒絕的原因)。如果你看到 "<strong>A promise chain failed to handle a rejection</strong>",那很有可能是程式碼中有東西需要修正。請參考 <a href="#Handling_errors_and_common_pitfalls" title="#Handling_errors_and_common_pitfalls">handling errors and common pitfalls</a> 。</p> +</div> + +<h2 id="文件規範">文件規範</h2> + +<p>在說明文件中,完成值的型別通常被定義在角括號中。舉例來說,<code><a href="/en-US/docs/JavaScript_OS.File/OS.File_for_the_main_thread#OS.File.exists()" title="/en-US/docs/JavaScript_OS.File/OS.File_for_the_main_thread#OS.File.exists()">OS.File.exists</a></code> 方法回傳的 promise 最終將會履行一個 boolean。</p> + +<pre>Promise<boolean> exists(string path); +</pre> + +<p>拒絕原因通常可以分別在方法的文件中定義,而且當沒有特別說明時它將被當作是一個 <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error" title="/en-US/docs/JavaScript/Reference/Global_Objects/Error"><code>Error</code></a> 物件。</p> + +<h2 id="方法總覽">方法總覽</h2> + +<table class="standard-table"> + <tbody> + <tr> + <td><code>Promise <a href="#then()">then</a>([optional] <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="/en-US/docs/JavaScript/Reference/Global_Objects/Function">Function</a> onFulfill, </code><code>[optional] </code><code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="/en-US/docs/JavaScript/Reference/Global_Objects/Function">Function</a> onReject</code><code>);</code></td> + </tr> + <tr> + <td><code>Promise <a href="#catch">catch</a>([optional] <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function">Function</a> onReject);</code></td> + </tr> + </tbody> +</table> + +<h2 id="建構子">建構子</h2> + +<p>創建一個新的 promise ,初始化等待狀態,並提供一些 resolving 方法的參照,這些方法將可以用來改變它的狀態。</p> + +<pre>new Promise(executor); +</pre> + +<h3 id="參數">參數</h3> + +<dl> + <dt><code>executor</code></dt> + <dd> + <p>這個方法將立刻被呼叫,伴隨著兩個 resolving 方法作為其參數:</p> + + <pre>executor(resolve, reject); +</pre> + + <p>建構子在 executor 結束之前不會結束。那些 resolving 方法可以在任何時候被使用,包含 executor 完成前和完成後,用來控制 promise 的最終狀態。如果 executor 拋出了例外,例外的值將被當作參數傳入 <code>reject</code> 方法。</p> + </dd> +</dl> + +<h3 id="Resolving_方法">Resolving 方法</h3> + +<h4 id="resolve()">resolve()</h4> + +<p>執行將特定值連結到 promise 的工作,或是傳遞狀態到一個已存在的 promise。如果被連結的 promise 已經處於被解決的狀態,無論是被連結到值、拒絕原因、或另外一個 promise,這個方法將不會做任何事。</p> + +<div class="note"><strong>註:</strong> 用一個等待中的 promise 當作此方法的 <code>aValue</code> 參數,並在這個 promise 被解決或被拒絕前再次呼叫此方法,第二次的呼叫並不會有任何效果,因為原本的 promise 已經被連結到這個等待中的 promise。</div> + +<pre>void resolve( + aValue +); +</pre> + +<h6 id="參數_2">參數</h6> + +<dl> + <dt><code>aValue</code> <span class="inlineIndicator optional optionalInline">Optional</span></dt> + <dd>如果這個值不是一個 promise,包含 <code>undefined</code>,它將成為被連結 promise 的完成值。如果這個值是一個 promise,則被連結的 promise 將會連結到這個傳入的 promise,並和它保持一樣的狀態(包含任何未來的轉變)。</dd> +</dl> + +<h4 id="reject()">reject()</h4> + +<p>用指定的原因拒絕被連結的 promise。如果該 promise 已經被解決,無論是連結到值、拒絕原因、或另外一個 promise,這個方法將不會做任何事。</p> + +<pre>void reject( + aReason +); +</pre> + +<h6 id="參數_3">參數</h6> + +<dl> + <dt><code>aReason</code> <span class="inlineIndicator optional optionalInline">Optional</span></dt> + <dd> + <p>被連結 promise 的拒絕原因。雖然原因可以是 <code>undefined</code>,它通常會是一個 <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error" title="/en-US/docs/JavaScript/Reference/Global_Objects/Error"><code>Error</code></a> 物件對象,就像例外處理那樣。</p> + + <div class="note"><strong>註:</strong> 這個參數不應該是一個 promise。指定一個拒絕 promise 作為拒絕原因會讓拒絕原因等於這個拒絕 promise 物件本身,而不是該 promise 的拒絕原因。</div> + </dd> +</dl> + +<h2 id="方法">方法</h2> + +<h3 id="then()">then()</h3> + +<p>在 promise 被完成或是被拒絕後立刻呼叫提供的方法。一個新的 promise 將被回傳,新 promise 的狀態改變將基於此 promise 和提供的 callback 方法。</p> + +<p>一個適當的 callback 總是在這個方法回傳後調用,無論此 promise 是否已經被完成或是被拒絕。你也可以在同一個 promise 上多次呼叫 <code>then</code> 方法,callback 們將被依照它們的註冊順序依序被調用。</p> + +<div class="warning"> +<p><strong>警告: </strong>如果 <code>onFulfill</code> callback 拋出例外, <code>onReject</code> callback 並不會被調用,錯誤也不會顯示在 console(你將會看到 promise 鍊失敗錯誤)。作為替代方法,你可以在你準備回傳的 promise 上註冊一個拒絕 callback 方法(使用 catch() 或是 then()),用於處理任何此 promise 上註冊的 callback 中拋出的例外。</p> +</div> + +<div class="note"><strong>註:</strong> 當你在同一個 promise 上呼叫多次 <code>then</code> 方法時,註冊的 callback 們將被獨立的調用。舉例來說,如果任何例外發生在其中一個 callback 中,它將不會影響其餘 callback 的執行。callback 的行為只會影響它註冊的 <code>then</code> 方法回傳的 promise。實際上,每次調用 <code>then</code> 方法將回傳完全不同的 promise。</div> + +<pre>Promise then( + Function onFulfill, + Function onReject +); +</pre> + +<h6 id="參數_4">參數</h6> + +<dl> + <dt><code>onFulfill</code> <span class="inlineIndicator optional optionalInline">Optional</span></dt> + <dd>如果 promise 被完成,這個方法將被調用,完成值將作為它的唯一參數,此方法的回傳值將決定 <code>then</code> 方法回傳的新 promise 的狀態。若此參數不是一個方法(通常為<code>null</code>),<code>then</code> 方法回傳的新 promise 將被用和原本 promise 相同的完成值完成。</dd> + <dt><code>onReject</code> <span class="inlineIndicator optional optionalInline">Optional</span></dt> + <dd> + <p>如果 promise 被拒絕,這個方法將被調用,拒絕原因將作為它的唯一參數,此方法的回傳值將決定 <code>then</code> 方法回傳的新 promise 的狀態。若此參數不是一個方法(通常為<code>null</code>),<code>then</code> 方法回傳的新 promise 將被用和原本 promise 相同的拒絕原因拒絕。</p> + </dd> +</dl> + +<h6 id="回傳值">回傳值</h6> + +<p>一個預設等待的 promise ,接著可以假設其狀態基於 callback 方法的結果:</p> + +<ul> + <li>如果 callback 回傳一個不是 primise 的值,包含 <code>undefined</code>,新的 promise 將被用這個值完成,就算原本的 primise 是被拒絕的。</li> + <li>如果 callback 拋出例外,新的 promise 將被用這個例外當作拒絕原因拒絕,就算原本的 promise 是被完成的。</li> + <li>如果 callback 回傳一個 promise ,則可以假設新的 promise 最終將會和該 promise 擁有相同的狀態。</li> +</ul> + +<h3 id="catch()"><a name="catch">catch()</a></h3> + +<p>相當於呼叫 <code>then()</code> ,並使用 <code>undefined</code> 作為 <code>onFulfill</code> 參數的值。如果你串接 <code>then(onFulfile).catch(onReject)</code>,<code>onFulfill</code> 拋出的例外將會被攔截並傳入 <code>onReject</code> ,這和直接將 <code>onReject</code> 傳入 <code>then()</code> 中不同。</p> + +<pre>Promise catch( + Function onReject +); +</pre> + +<p>因此以下的呼叫是等價的:</p> + +<pre>p.then(undefined, logError); +p.catch(logError); +</pre> + +<h2 id="除錯">除錯</h2> + +<p>基於 promise 的設計, promise 對象的狀態和值無法在不調用 <code><a href="#then()" title="#then()">then()</a></code> 的前提下同步地檢視。</p> + +<p>為了幫助除錯,只有在手動檢視 promise 對象時,才能看到更多資訊,這些資訊是代碼無法訪問的特殊屬性(目前,這是透過隨機化屬性名稱來實現的,因為缺少更複雜的語言或調適器的支持)。</p> + +<p>這些代碼無法訪問,可檢視的屬性為:</p> + +<ul> + <li><code><strong><span>{</span>{private:status}}</strong></code>: <strong>0</strong> 為等待, <strong>1</strong> 為完成, <strong>2</strong> 為拒絕。</li> + <li><code><strong><span>{</span>{private:value}}</strong></code>: 完成值或是拒絕原因,只對已完成或是已拒絕的 promise 有效。</li> + <li><code><strong><span>{</span>{private:handlers}}</strong></code>: 一個持有通過 <code><a href="#then()" title="#then()">then()</a></code> 方法註冊之方法的參照的物件陣列,只對等待中的 promise 有效。</li> +</ul> + +<p style="text-align: center;"><img alt="Promise properties are visible in the debugger." src="https://mdn.mozillademos.org/files/6471/Promise-Debug-1.png" style="border-style: solid; border-width: 2px; height: 482px; margin-bottom: 15px; margin-top: 15px; width: 403px;"><img alt="Promise handlers can be watched from the Console." src="https://mdn.mozillademos.org/files/6473/Promise-Debug-2.png" style="border-style: solid; border-width: 2px; height: 161px; width: 977px;"></p> + +<h2 id="範例">範例</h2> + +<p>參見 <a href="/Mozilla/JavaScript_code_modules/Promise.jsm/Examples">examples</a>.</p> + +<h2 id="錯誤處理和常見的陷阱">錯誤處理和常見的陷阱</h2> + +<p>你應該回報沒有被處理的錯誤,除非你將 promise 移交給調用者或是交給其他的代碼來處理這些錯誤。</p> + +<pre class="brush: js">// ###### WRONG: Silently drops any rejection notified by "OS.File.Exists". +OS.File.exists(path).then(exists => { if (exists) myRead(path); }); + +// ###### WRONG: Silently drops any exception raised by "myRead". +OS.File.exists(path).then(exists => { if (exists) myRead(path); }, Components.utils.reportError); + +// CORRECT (for example, might report the exception "myRead is not defined") +OS.File.exists(path).then(exists => { if (exists) myRead(path); }) + .catch(Components.utils.reportError); + +// CORRECT (the function returns a promise, and the caller will handle the rejection) +function myReadIfExists(path) +{ + return OS.File.exists(path).then(exists => { if (exists) myRead(path); }); +}</pre> + +<h2 id="參見">參見</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm">Promise.jsm</a></li> + <li><a href="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred" title="/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred">Deferred</a></li> + <li><a href="/Mozilla/JavaScript_code_modules/Promise.jsm/Examples">Examples</a></li> + <li><a href="/en-US/docs/JavaScript_OS.File" title="/en-US/docs/JavaScript_OS.File">JavaScript OS.File</a></li> + <li><a href="http://kryogenix.org/days/2013/12/12/promises-promises">Promises, Promises</a>: a useful simple explanation by Stuart Langridge</li> + <li><a href="http://dom.spec.whatwg.org/#promises">WHATWG Living Standard</a></li> +</ul> diff --git a/files/zh-tw/mozilla/js-ctypes/index.html b/files/zh-tw/mozilla/js-ctypes/index.html new file mode 100644 index 0000000000..a49961f677 --- /dev/null +++ b/files/zh-tw/mozilla/js-ctypes/index.html @@ -0,0 +1,97 @@ +--- +title: js-ctypes +slug: Mozilla/js-ctypes +translation_of: Mozilla/js-ctypes +--- +<p>{{jsctypesSidebar("Introduction")}}</p> + +<p><strong>js-ctypes</strong> allows application and extension code to call back and forth to native code written in C. C++ support is possible through <code>vtable </code>pointers see <a href="/en-US/docs/Mozilla/js-ctypes/Examples/Using_COM_from_js-ctypes">使用 COM</a>. For a discussion on extended C++ support see {{bug("505907")}}. Unlike binary XPCOM components, It allows developers to ship a single binary for use with multiple versions of Firefox.</p> + +<div class="note"><strong>Note:</strong> js-ctypes 只能使用在 chrome 的應用程式和擴展裡,</div> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="Documentation" name="Documentation">文件</h2> + + <dl> + <dt><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes" title="Mozilla/js-ctypes/Using_js-ctypes">使用 JS-Ctypes</a></dt> + <dd> + <ul> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/ctypes.open">ctypes.open</a> + <ul> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/ctypes.open#Custom_Native_File">Custom Native File</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Standard_OS_Libraries" title="Mozilla/js-ctypes/Standard_Libraries_per_OS">Standard OS Libraries</a> + <ul> + <li><a href="/en-US/Add-ons/Code_snippets/Finding_Window_Handles">Finding window handles</a></li> + </ul> + </li> + </ul> + </li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Working_with_data">Working with Data</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Working_with_ArrayBuffers">Working with ArrayBuffers</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Declaring_types">Declaring Types</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Declaring_and_calling_functions">Declaring and Calling Functions</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/Callbacks">Declaring and Using Callbacks</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Type_conversion">Type Conversion</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/Memory_Management">Memory Management</a></li> + <li><a href="/en-US/docs/Web/API/ChromeWorker">ChromeWorker</a></li> + </ul> + </dd> + <dt><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference" title="js-ctypes/js-ctypes_reference">JS-ctypes 參考</a></dt> + <dd>參考 js-ctypes API. + <ul> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/ABI">ABI</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/CData">CData</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/CType">CType</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/ctypes">ctypes</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/FunctionType">FunctionType</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/Int64">Int64</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/Library">Library</a></li> + <li><a href="/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/UInt64">UInt64</a></li> + </ul> + </dd> + </dl> + + <p><span class="alllinks"><a href="/en-US/docs/tag/js-ctypes" title="tag/js-ctypes">View All...</a></span></p> + + <h2 class="Tools" id="Examples" name="Examples"><a href="/en-US/docs/Mozilla/js-ctypes/Examples" title="Mozilla/js-ctypes/Examples">範例</a></h2> + + <dl> + <dt><a href="/en-US/docs/Mozilla/js-ctypes/Examples/Add_to_iPhoto" title="Mozilla/js-ctypes/Examples/Add_to_iPhoto">Add to iPhoto</a></dt> + <dd>A Firefox extension that uses js-ctypes to call Carbon and Core Foundation framework routines on Mac OS X to implement an "Add image to iPhoto" feature in Firefox.</dd> + <dt><a href="/en-US/docs/Mozilla/js-ctypes/Examples/Using_C_structs_and_pointers">使用 C 結構和指針</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/js-ctypes/Examples/Using_COM_from_js-ctypes">使用 COM</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/js-ctypes/Examples/Using_Objective-C_from_js-ctypes">使用 Objective-C</a></dt> + </dl> + + <p><strong><a href="/en-US/docs/Mozilla/js-ctypes/Examples/Using_JNI_from_js-ctypes">使用 JNI/Java</a></strong></p> + + <dl> + <dt><a href="https://github.com/ochameau/jscpptypes">Github :: ochameau / jscpptypes</a></dt> + <dd>A mangling library to use C++ from js-ctypes</dd> + </dl> + </td> + <td> + <h2 class="Community" id="Community" name="Community">社群</h2> + + <ul> + <li>View Mozilla forums...{{DiscussionList("dev-extensions", "mozilla.dev.extensions")}}</li> + <li><a href="irc://moznet/jsctypes">IRC - #jsctypes</a></li> + <li><a href="http://stackoverflow.com/questions/tagged/jsctypes">Stackoverflow - jsctypes</a></li> + </ul> + + <h2 class="Related_Topics" id="Related_Topics" name="Related_Topics">相關文件</h2> + + <ul> + <li><a href="/en-US/docs/Mozilla/Tech/XPCOM/Guide/Changes_in_Gecko_2.0#Binary_components">XPCOM in Gecko 2 - Binary Components</a></li> + </ul> + </td> + </tr> + </tbody> +</table> + +<p> </p> diff --git a/files/zh-tw/mozilla/localization/index.html b/files/zh-tw/mozilla/localization/index.html new file mode 100644 index 0000000000..eee1265f5f --- /dev/null +++ b/files/zh-tw/mozilla/localization/index.html @@ -0,0 +1,25 @@ +--- +title: Mozilla 在地化 +slug: Mozilla/Localization +tags: + - Landing + - Localization + - Mozilla + - NeedsTranslation + - TopicStub + - Translation + - l10n +translation_of: Mozilla/Localization +--- +<p><span class="seoSummary"><strong>在地化</strong>(Localization、L10n)指的是翻譯軟體的使用者介面,從一個語言到另一個語言,並調整到適合該語言的文化。這些資源提供給所有對於在地化的技術層面感興趣的人。</span>像是開發者和貢獻者。</p> + +<h2 id="延伸閱讀">延伸閱讀</h2> + +<dl> + <dt><a href="/zh-TW/docs/Project:MDN/Localizing" title="/en-US/docs/Project:MDN/Localizing">Localizing MDN</a></dt> + <dd>這些資源涵蓋了 MDN 文件的在地化。</dd> + <dt><a href="/zh-TW/Apps/Build/Localization">App localization</a></dt> + <dd>這一系列文件特別用於在地化應用程式,包含 Firefox OS 應用程式。</dd> + <dt><a href="/zh-TW/docs/Web/API/L10n">L10n</a></dt> + <dd>Mozilla 用於在地化 Firefox OS 的 L10n API 參考文件。</dd> +</dl> diff --git a/files/zh-tw/mozilla/localization/localizing_with_pontoon/index.html b/files/zh-tw/mozilla/localization/localizing_with_pontoon/index.html new file mode 100644 index 0000000000..08461fecd6 --- /dev/null +++ b/files/zh-tw/mozilla/localization/localizing_with_pontoon/index.html @@ -0,0 +1,135 @@ +--- +title: 使用 Pontoon 來在地化 +slug: Mozilla/Localization/Localizing_with_Pontoon +translation_of: Mozilla/Localization/Localizing_with_Pontoon +--- +<p><a href="https://pontoon.mozilla.org" title="https://pontoon.mozilla.org">Pontoon</a> 是一個基於web網頁的、所見即所得(WYSIWYG)的在地化(l10n即localization)工具。在Mozilla基金會,我們使用Pontoon本地化Mozilla網站和Firefox OS(火狐移動操作系統)的應用層(app)接口,就是Gaia。 Pontoon是一個非常簡單和直觀的,僅需要很少甚至沒有技術背景,就能在l10n本地化工作流程中,學會使用的工具。以下,我們將討論如何在本地化項目中使用Pontoon,從最初的註冊登錄到最終面對你的貢獻者(參與該項目的志願者或工作人員)。在這個過程中,我們將挑出Pontoon的一些貼心特性,那將使你十分有效率,並將使l10n本地化共享項目變得更容易。</p> + +<div class="note"> +<p><strong>你是位開發者嗎?</strong> 閱讀 <a href="/en-US/docs/Implementing_Pontoon_Mozilla">在你的網站上使用 Pontoon</a> 或學習如何在 <a href="https://github.com/mozilla/pontoon">GitHub</a> 上使用。</p> +</div> + +<h2 id="第一步">第一步</h2> + +<p><a href="https://pontoon.mozilla.org" title="https://pontoon.mozilla.org">Pontoon 的首頁</a> is very easy to use. To begin localizing the project, click on the Persona icon and sign in. Next, simply select the project you want to work on and your locale from the dropdown menus. Pontoon will automatically open that locale's project for you to get started. Note that for our purposes here, we'll be using <a href="https://affiliates.mozilla.org/">Firefox Affiliates</a> website to demo Pontoon's functionality and workflow. And there it is, opened inside Pontoon:</p> + +<p><em><img alt="Browser app and workspace" src="https://mdn.mozillademos.org/files/8323/affiliates.png" style="height: 558px;"></em></p> + +<h3 id="主要工具列">主要工具列</h3> + +<p>如你所見,most of the interface is taken by the website being translated. Only the toolbar on top belongs to Pontoon, containing the following items (from left to right):</p> + +<p><img alt="Main toolbar" src="https://mdn.mozillademos.org/files/8325/toolbar.png"></p> + +<h4 id="字串列表">字串列表</h4> + +<p>Opens a sidebar with a list of all strings to localize.</p> + +<h4 id="Project_selector_(Affiliates)"><span id="cke_bm_939S" style="display: none;"> </span>Project selector (Affiliates)</h4> + +<p>Switches between projects to localize.</p> + +<h4 id="Resource_selector_(Homepage)"><span id="cke_bm_940S" style="display: none;"> </span>Resource selector (Homepage)</h4> + +<p>Switches between project resources to localize, like subpages or localization files. Hidden if no resources available for project.</p> + +<h4 id="sect1"><span id="cke_bm_941S" style="display: none;"> </span></h4> + +<dl> +</dl> + +<h4 id="Locale_selector_(Slovenian)">Locale selector (Slovenian)</h4> + +<p>Switches between languages to localize.</p> + +<h4 id="Go">Go</h4> + +<p>Opens project-resource-locale selection.</p> + +<h4 id="Progress_indicator">Progress indicator</h4> + +<p>Displays your progress on the resource being localized. More details are available in the popup.</p> + +<dl> +</dl> + +<h4 id="使用者清單"><span id="cke_bm_943S" style="display: none;"> </span>使用者清單</h4> + +<p>Allows for user-specific tasks, like commiting to repository, downloading files and signing out.</p> + +<h4 id="資訊清單">資訊清單</h4> + +<p>Gives important information, like the anticipated project timeline and a list of keyboard shortcuts.</p> + +<dl> +</dl> + +<p>好了,我們現在是不是該來翻譯啦~<span id="cke_bm_608E" style="display: none;"> </span></p> + +<dl> +</dl> + +<h2 id="翻譯字串">翻譯字串</h2> + +<p>當使用 Pontoon 來在地化時,你有多種選擇來翻譯你的字串,你可以直接修改內容、在內容外或是兩種混和。We'll start with looking at in-context translation.</p> + +<h3 id="內容中">內容中</h3> + +<p>Pontoon's in-context translation mode is what puts it above others. It opens a web page (or web app) and enables real-time editing of that page. Here's how you translate your first string:</p> + +<p><img alt="In-context localization" src="https://mdn.mozillademos.org/files/8331/in-context.png"></p> + +<ol> + <li>Hover over the text you want to translate with your mouse.</li> + <li>An edit button appears over that text. Click on it to enable the translate mode.</li> + <li>Replace the original text with its translation into your language.</li> + <li>Click the save button to save your translation.</li> +</ol> + +<div> +<h3 id="內容外">內容外</h3> + +<p>Some strings are impossible to translate in-context, e.g. the contents of the <title> tag in websites and strings with placeables or different plural forms. By clicking on the hamburger icon in the main toolbar, a list of all strings and available translations will open in the sidebar. You can also use the sidebar for out-of-context localization:</p> + +<p><img alt="Out-of-context localization: list" src="https://mdn.mozillademos.org/files/8337/out-of-context-1.png"> <img alt="Out-of-context localization: translate" src="https://mdn.mozillademos.org/files/8335/out-of-context-2.png"></p> + +<ol> + <li>點擊你想要翻譯的字串。</li> + <li>Translation panel with original string and its details (e.g. comments) opens.</li> + <li>Translate the string in the translation area below.</li> + <li>按下儲存按鈕來儲存你的翻譯。</li> +</ol> + +<p>當你在內容外翻譯,成果將會直接在內容上呈現,if they could also be translated in-context.</p> + +<h3 id="翻譯小助手">翻譯小助手</h3> +</div> + +<p>如你所見,suggestions from history, translation memory, machine translation and other locales are also available in the out-of-context translation panel. We call all of these translation helpers and here's how each of them will help you as you translate strings:</p> + +<p><img alt="Translation helpers: History" src="https://mdn.mozillademos.org/files/8339/helpers-history.png"> <img alt="Translation helpers: Machinery" src="https://mdn.mozillademos.org/files/8341/helpers-machinery.png"> <img alt="Translation helpers: Other locales" src="https://mdn.mozillademos.org/files/8343/helpers-locales.png"> <img alt="Translation helpers: Search" src="https://mdn.mozillademos.org/files/8345/helpers-menu.png"></p> + +<h4 id="歷史紀錄">歷史紀錄</h4> + +<p>Displays previously suggested translations, including from other users.</p> + +<h4 id="Machinery">Machinery</h4> + +<p>Displays matches from various services: internal translation memory, <a href="http://transvision.mozfr.org/">Mozilla Transvision</a>, <a href="https://amagama-live.translatehouse.org/">open source translation memory</a>, <a href="http://www.microsoft.com/Language/">Microsoft terminology</a> and <a href="http://www.bing.com/translator">machine translation</a>.</p> + +<h4 id="其他語言">其他語言</h4> + +<p>Displays matching translations from other locales.</p> + +<h4 id="搜尋">搜尋</h4> + +<p>Almost like machinery, but takes provided keyword as input parameter instead of the original string.</p> + +<p>By clicking a suggestion, it gets copied into translation area.</p> + +<dl> +</dl> + +<h2 id="發布你的在地化">發布你的在地化</h2> + +<p>Suppose you now want to publish your l10n work by committing it to a repo. Pontoon lets you do that too! Actually, it does that for you by automatically syncing with repositories on hourly basis. You can now pat yourself on the back, do a little dance, go to sleep or do something else to celebrate your work!</p> diff --git a/files/zh-tw/mozilla/mathml_project/index.html b/files/zh-tw/mozilla/mathml_project/index.html new file mode 100644 index 0000000000..dea19cfe6f --- /dev/null +++ b/files/zh-tw/mozilla/mathml_project/index.html @@ -0,0 +1,60 @@ +--- +title: Mozilla MathML Project +slug: Mozilla/MathML_Project +tags: + - MathML + - MathML Project + - NeedsTranslation + - TopicStub +translation_of: Mozilla/MathML_Project +--- +<p>The Mozilla MathML project is Mozilla's project to build and enhance <a href="/en-US/docs/Web/MathML" title="/en-US/docs/Web/MathML">MathML</a> support within Firefox and other Mozilla-based applications. For a quick overview, see the <a href="http://fred-wang.github.io/MozSummitMathML/index.html">slides for the innovation fairs at Mozilla Summit 2013</a>.</p> +<h2 id="Updates">Updates</h2> +<p><img alt="Mathzilla" class="internal default" height="150" src="https://mdn.mozillademos.org/files/6281/mathzilla.svg" style="float: right;" width="150"></p> +<ul> + <li><a href="/docs/Mozilla/MathML_Project/Status" title="Mozilla MathML Project/Status">Status of each tag</a></li> + <li><a href="/docs/Mozilla/MathML_Project/MathML3Testsuite" title="Mozilla MathML Project/MathML3Testsuite">Result of the MathML 3 Testsuite</a></li> + <li><a class="external" href="https://www.wg9s.com/mozilla/firefox/">Unofficial nightly builds with MathML patches applied</a> (maintained by Bill Gianopoulos)</li> + <li><a href="/docs/Mozilla/MathML_Project/Updates" title="Mozilla_MathML_Project/Updates">More updates and archived content</a></li> +</ul> +<h2 id="Community">Community</h2> +<ul> + <li>View Mozilla forums... {{DiscussionList("dev-tech-mathml", "mozilla.dev.tech.mathml")}}</li> + <li><a class="link-irc" href="irc://irc.mozilla.org/%23mathml" rel="external" title="irc://irc.mozilla.org/%23mathml">IRC channel</a></li> + <li><a class="link-https" href="https://wiki.mozilla.org/MathML:Home_Page">Wiki used by contributors</a> - check out the latest developments and help us improving MathML in Mozilla.</li> +</ul> +<h2 id="Links">Links</h2> +<ul> + <li>Installing <a href="/docs/Mozilla/MathML_Project/Fonts" title="Mozilla MathML Project/Fonts">fonts for Mozilla's MathML engine</a></li> + <li><a class="external" href="http://www.w3.org/TR/MathML3/">MathML Version 3.0</a> - W3C Recommendation, 21 October 2010</li> + <li><a class="external" href="http://www.w3.org/Math/testsuite/"><abbr>W3C</abbr> <abbr>MathML</abbr> Test Suite</a> - Designed to check the implementation of each element one attribute (or built-in rendering behavior) at a time in a fairly thorough manner.</li> + <li><a href="/docs/Web/MathML" title="MathML">MathML in Mozilla Developer Network</a></li> +</ul> +<h3 id="Sample_MathML_Documents">Sample <abbr>MathML</abbr> Documents</h3> +<ul> + <li><a href="/docs/Mozilla/MathML_Project/Screenshots" title="Mozilla MathML Project/Screenshots">Screenshots</a></li> + <li><a href="/docs/Mozilla/MathML_Project/Start" title="Mozilla_MathML_Project/Start"><abbr>MathML</abbr> Start Page</a> - with translations in different languages ( <a href="/ar/docs/Mozilla_MathML_Project/Start" title="/ar/Mozilla_MathML_Project/Start">Arabic</a>, <a href="/zh-CN/docs/Mozilla_MathML_Project/Start" title="/zh-CN/Mozilla_MathML_Project/Start">Chinese</a>, <a href="/he/docs/Mozilla_MathML_Project/Start" title="/he/Mozilla_MathML_Project/Start">Hebrew</a>, <a href="/th/docs/Mozilla_MathML_Project/Start" title="/th/Mozilla_MathML_Project/Start">Thai</a>)</li> + <li><a class="external" href="/docs/Mozilla/MathML_Project/Basics">MathML Basics</a> - Document tailored to display correctly with just the Symbol font that is pre-installed by default on most OS configurations.</li> + <li><a class="external" href="/docs/Mozilla/MathML_Project/MathML_Torture_Test"><abbr>MathML</abbr> Torture Test</a> - Comparative testing of MathML rendering against TeX.</li> + <li>Demo of some MathML tags: <a class="external" href="/docs/Mozilla/MathML_Project/mfrac">mfrac</a>, <a class="external" href="/docs/Mozilla/MathML_Project/mo">mo</a>, <a class="external" href="/docs/Mozilla/MathML_Project/mtable">mtable</a>, <a class="external" href="/docs/Mozilla/MathML_Project/mspace">mspace</a>, <a class="external" href="/docs/Mozilla/MathML_Project/mmultiscripts">mmultiscripts</a>, <a class="external" href="/docs/Mozilla/MathML_Project/roots">msqrt-mroot</a>.</li> + <li><a class="external" href="/docs/Mozilla/MathML_Project/Extras">MathML Extras</a> - Technology demonstration of some interesting upshots from building natively upon the browser environment.</li> + <li><a href="/docs/Mozilla/MathML_Project/Various" title="Mozilla_MathML_Project/Various">Various MathML Tests</a> - These pages were imported from <code>layout/mathml/tests/</code>.</li> + <li><a class="external" href="http://golem.ph.utexas.edu/~distler/blog/archives/000104.html">Blog</a> with comments that include MathML.</li> +</ul> +<h3 id="Create_MathML_Documents">Create <abbr>MathML</abbr> Documents</h3> +<ul> + <li><a href="/docs/Web/MathML/Authoring" title="Mozilla MathML Project/Authoring">Authoring MathML</a></li> + <li><a class="external" href="http://www.w3.org/Math/Software/mathml_software_cat_editors.html">Editors</a></li> + <li><a class="external" href="http://www.w3.org/Math/Software/mathml_software_cat_converters.html">Converters</a></li> + <li><a class="external" href="http://www.w3.org/Math/Software/mathml_software_cat_stylesheets.html">Stylesheets</a></li> +</ul> +<div class="originaldocinfo"> + <h2 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h2> + <ul> + <li>Author(s): Roger B. Sidje</li> + <li>Other Contributors: Frédéric Wang</li> + <li>Last Updated Date: April 4, 2010</li> + <li>Copyright Information: Portions of this content are © 1999–2010 by individual mozilla.org contributors; content available under a Creative Commons license | <a class="external" href="http://www.mozilla.org/foundation/licensing/website-content.html">Details</a>.</li> + </ul> +</div> +<p> </p> diff --git a/files/zh-tw/mozilla/mathml_project/screenshots/index.html b/files/zh-tw/mozilla/mathml_project/screenshots/index.html new file mode 100644 index 0000000000..880c0ddd35 --- /dev/null +++ b/files/zh-tw/mozilla/mathml_project/screenshots/index.html @@ -0,0 +1,14 @@ +--- +title: MathML 快照 +slug: Mozilla/MathML_Project/Screenshots +translation_of: Mozilla/MathML_Project/Screenshots +--- +<ul> + <li><a href="https://developer.mozilla.org/docs/Mozilla/MathML_Project/Start">起始</a>的<a href="https://developer.mozilla.org/@api/deki/files/5690/=start.png" title="start.png">快照畫面</a></li> + <li><a href="https://developer.mozilla.org/docs/Mozilla/MathML_Project/Basics">基礎</a>的<a href="https://developer.mozilla.org/@api/deki/files/5518/=basics.png">快照畫面</a></li> + <li><a class="external" href="/docs/Mozilla/MathML_Project/mfrac" title="http://www.mozilla.org/projects/mathml/demo/mfrac.xhtml">mfrac</a>的<a href="https://developer.mozilla.org/@api/deki/files/5509/=demo-mfrac.png">快照畫面</a>。 此網頁同時顯示MathML如何整合網頁功能,例如:影像背景的透明度。</li> + <li><a class="external" href="/docs/Mozilla/MathML_Project/mtable" title="http://www.mozilla.org/projects/mathml/demo/mtable.xhtml">mtable</a>的<a href="https://developer.mozilla.org/@api/deki/files/5512/=demo-mtable-1.png">快照畫面</a>,這些畫面展示二維數學公式的排版。</li> + <li><a href="https://developer.mozilla.org/docs/Mozilla/MathML_Project/roots">根</a>與<a href="https://developer.mozilla.org/docs/Mozilla/MathML_Project/Various#Maxwell's_Equations">物理公式</a>(馬克斯公式及愛因斯坦磁場公式)的<a href="https://developer.mozilla.org/@api/deki/files/5508/=roots-maxwell-einstein.png">快照畫面</a>,這些畫面展現出利用mtable與彈性運算元進階佈局功能。</li> + <li>你可以獲取關於<a href="https://developer.mozilla.org/@api/deki/files/5510/=view_mathml_source.png">數學公式</a>或<a href="https://developer.mozilla.org/@api/deki/files/5511/=view_selection_source.png">選取的算術式</a>的原始碼。這些都是你自己的選擇!</li> + <li>一些關於MathML的<a href="https://developer.mozilla.org/@api/deki/files/4240/=mail_client_blog.png">網誌貼文</a>及<a href="https://developer.mozilla.org/@api/deki/files/5519/=mathmail.png">郵件</a>。</li> +</ul> diff --git a/files/zh-tw/mozilla/mathml_project/開頭/index.html b/files/zh-tw/mozilla/mathml_project/開頭/index.html new file mode 100644 index 0000000000..6572d9e913 --- /dev/null +++ b/files/zh-tw/mozilla/mathml_project/開頭/index.html @@ -0,0 +1,91 @@ +--- +title: 使用 MathML +slug: Mozilla/MathML_Project/開頭 +tags: + - MathML +translation_of: Mozilla/MathML_Project/Start +--- +<h2 id="使用_MathML">使用 MathML</h2> +<p>你有看到這頁面理那些精巧的數學算式嗎? 沒有嗎? 太糟糕了, 來<a href="https://developer.mozilla.org/@api/deki/files/5690/=start.png">這邊</a>看一下你錯過了什麼東西吧。 並快<a href="https://developer.mozilla.org/en-US/docs/Mozilla/MathML_Project/">下載</a>支援這個功能的 Mozilla 板本來補救這哀傷的場面!</p> +<p>還是你發現你看到的畫面根螢幕截圖不一樣呢? 這牆況通常是因為你少了某些關鍵的 <a href="https://developer.mozilla.org/en-US/docs/Mozilla/MathML_Project/fonts/">MathML 字型</a>。</p> +<p>現在準備萬全了, 你應該看得到這個行內等式的尖角符號: <math> <mrow> <mover> <mi>x</mi> <mo>^</mo> </mover> <mo>+</mo> <mover> <mrow><mi>x</mi><mo></mo><mi>y</mi></mrow> <mo>^</mo> </mover> <mo>+</mo> <mover> <mrow><mi>x</mi><mo></mo><mi>y</mi><mo></mo><mi>z</mi></mrow> <mo>^</mo> </mover> <mo>.</mo> </mrow></math>旁邊這個則是小小的公式, <math> <mrow> <mo>det</mo> <mo lspace="0" rspace="0" symmetric="false">|</mo> <mfrac linethickness="0"> <mi>a</mi> <mi>c</mi> </mfrac> <mfrac linethickness="0"> <mi>b</mi> <mi>d</mi> </mfrac> <mo lspace="0" rspace="0" symmetric="false">|</mo> <mo>=</mo> <mi>a</mi> <mi>d</mi> <mo>-</mo> <mi>b</mi> <mi>c</mi> <mo>,</mo> </mrow></math>也可以被設定成這樣的顯示方式: <math display="block"> <mrow> <mo>det</mo> <mo>|</mo> <mtable> <mtr> <mtd> <mi>a</mi> </mtd> <mtd> <mi>b</mi> </mtd> </mtr> <mtr> <mtd> <mi>c</mi> </mtd> <mtd> <mi>d</mi> </mtd> </mtr> </mtable> <mo>|</mo> <mo>=</mo> <mi>a</mi> <mi>d</mi> <mo>-</mo> <mi>b</mi> <mi>c</mi> <mo>.</mo> </mrow> </math></p> +<p>數學的排版非常的挑剔。 <a href="./">MathML in Mozilla</a> 正是著眼於實踐 <a href="http://www.w3.org/Math/">MathML 標準</a> + <i> + </i> + 以能達到<em> 所標記即所得</em> 、或者說 <em>所製即所得</em> + <i> + </i> + ,簡短點就是所謂的 "WYSIWYM"。 而這兩者的差異可以在下面的兩行算式表現出來!<math display="block"><msup><mrow><mo minsize="3" symmetric="false">(</mo> <mo>...</mo> <msup> <mrow> <mo minsize="2" symmetric="false">(</mo> <msup> <mrow> <mo symmetric="false">(</mo> <msub> <mi>a</mi> <mn>0</mn> </msub> <mo>+</mo> <msub> <mi>a</mi> <mn>1</mn> </msub> <mo symmetric="false">)</mo> </mrow> <msub> <mi>n</mi> <mn>1</mn> </msub> </msup> <mo>+</mo> <msub> <mi>a</mi> <mn>2</mn> </msub> <mo minsize="2" symmetric="false">)</mo> </mrow> <msub> <mi>n</mi> <mn>2</mn> </msub> </msup> <mo>+</mo> <mo>...</mo> <mo>+</mo> <msub> <mi>a</mi> <mi>p</mi> </msub> <mo minsize="3" symmetric="false">)</mo> </mrow> <msub> <mi>n</mi> <mi>p</mi> </msub> </msup> </math> <math display="block"> <msup> <mrow> <mo>(</mo> <mo>...</mo> <msup> <mrow> <mo>(</mo> <msup> <mrow> <mo>(</mo> <msub> <mi>a</mi> <mn>0</mn> </msub> <mo>+</mo> <msub> <mi>a</mi> <mn>1</mn> </msub> <mo>)</mo> </mrow> <msub> <mi>n</mi> <mn>1</mn> </msub> </msup> <mo>+</mo> <msub> <mi>a</mi> <mn>2</mn> </msub> <mo>)</mo> </mrow> <msub> <mi>n</mi> <mn>2</mn> </msub> </msup> <mo>+</mo> <mo>...</mo> <mo>+</mo> <msub> <mi>a</mi> <mi>p</mi> </msub> <mo>)</mo> </mrow> <msub> <mi>n</mi> <mi>p</mi> </msub> </msup> </math></p> +<p>而這粗體等式的根 <math><mstyle mathvariant="bold"><msup><mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mstyle></math>也用粗體呈現 <math display="block"> <mstyle mathvariant="bold"> <mi>y</mi> <mo>=</mo> <mroot> <mrow> <mo>-</mo> <mfrac> <mi>q</mi> <mn>2</mn> </mfrac> <mo>+</mo> <mroot> <mrow> <mfrac> <msup> <mi>q</mi> <mn>2</mn> </msup> <mn>4</mn> </mfrac> <mo>+</mo> <mfrac> <msup> <mi>p</mi> <mn>3</mn> </msup> <mn>27</mn> </mfrac> </mrow> <mn>2</mn> </mroot> </mrow> <mn>3</mn> </mroot> <mo>+</mo> <mroot> <mrow> <mo>-</mo> <mfrac> <mi>q</mi> <mn>2</mn> </mfrac> <mo>-</mo> <mroot> <mrow> <mfrac> <msup> <mi>q</mi> <mn>2</mn> </msup> <mn>4</mn> </mfrac> <mo>+</mo> <mfrac> <msup> <mi>p</mi> <mn>3</mn> </msup> <mn>27</mn> </mfrac> </mrow> <mn>2</mn> </mroot> </mrow> <mn>3</mn> </mroot> <mo>.</mo> </mstyle> </math></p> +<p>而等式 <math><mrow><mi>a</mi> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo> <mi>b</mi> <mi>x</mi> <mo>+</mo> <mi>c</mi> <mo>=</mo> <mn>0</mn> <mo>,</mo> </mrow> </math>的根 在下面的黃色區域內點可以縮放它</p> +<div style="display: none;"> + <h2 id="Zoomable_Math" name="Zoomable_Math">Zoomable Math</h2> + <h3 id="HTML_Content">HTML Content</h3> + <pre class="brush: html"> <p> + <math display="block"> + <mstyle id="zoomableMath" mathbackground="yellow"> + <mrow> + <mi>x</mi> + <mo>=</mo> + <mfrac> + <mrow> + <mrow> + <mo>-</mo> + <mi>b</mi> + </mrow> + <mo>&#xB1;</mo> + <msqrt> + <mrow> + <msup> + <mi>b</mi> + <mn>2</mn> + </msup> + <mo>-</mo> + <mrow> + <mn>4</mn> + <mi>a</mi> + <mi>c</mi> + </mrow> + </mrow> + </msqrt> + </mrow> + <mrow> + <mn>2</mn> + <mi>a</mi> + </mrow> + </mfrac> + </mrow> + </mstyle> + </math> + </p> + +</pre> + <h3 id="JavaScript_Content">JavaScript Content</h3> + <pre class="brush: js"> function zoomToggle() + { + if (this.hasAttribute("mathsize")) { + this.removeAttribute("mathsize"); + } else { + this.setAttribute("mathsize", "200%"); + } + } + + function load() + { + document.getElementById("zoomableMath"). + addEventListener("click", zoomToggle, false); + } + + window.addEventListener("load", load, false);</pre> +</div> +<p style="text-align: center;">{{ EmbedLiveSample('Zoomable_Math') }}</p> +<p>還這邊這個有趣的筆記<math display="block"> <mrow><mo>{</mo> <mtable> <mtr> <mtd> <mrow> <msub> <mi>u</mi> <mi>t</mi> </msub> <mo>+</mo> <msub> <mrow> <mi>f</mi> <mo>(</mo> <mi>u</mi> <mo>)</mo> </mrow> <mi>x</mi> </msub> <mo>=</mo> <mn>0</mn> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>u</mi> <mo stretchy="false">(</mo> <mn>0</mn> <mo>,</mo> <mi>x</mi> <mo stretchy="false">)</mo> <mo>=</mo> <mrow> <mo>{</mo> <mtable> <mtr> <mtd> <mrow> <msup> <mi>u</mi> <mo>-</mo> </msup> </mrow> </mtd> <mtd> <mrow> <mtext>if </mtext> <mi>x</mi> <mo><</mo> <mn>0</mn> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msup> <mi>u</mi> <mo>+</mo> </msup> </mrow> </mtd> <mtd> <mrow> <mtext>if </mtext> <mi>x</mi> <mo>></mo> <mn>0</mn> </mrow></mtd></mtr></mtable></mrow></mrow></mtd></mtr></mtable></mrow></math></p> +<p>或是這個複雜的筆記 <math display="block"> <mrow> <msub> <mover> <mi>Ell</mi> <mo>^</mo> </mover> <mi>Y</mi> </msub> <mo stretchy="false">(</mo> <mi>Z</mi> <mo>;</mo> <mi>z</mi> <mo>,</mo> <mi>τ</mi> <mo stretchy="false">)</mo> <mo>:=</mo> <msub> <mo>∫</mo> <mi>Y</mi> </msub> <mo>(</mo> <munder> <mo>∏</mo> <mi>l</mi> </munder> <mfrac> <mrow> <mrow> <mo>(</mo> <mfrac> <msub> <mi>y</mi> <mi>l</mi> </msub> <mrow> <mn>2</mn> <mi>π</mi> <mi mathvariant="normal">i</mi> </mrow> </mfrac> <mo>)</mo> </mrow> <mrow> <mi>θ</mi> <mo>(</mo> <mfrac> <msub> <mi>y</mi> <mi>l</mi> </msub> <mrow> <mn>2</mn> <mi>π</mi> <mi mathvariant="normal">i</mi> </mrow> </mfrac> <mo>-</mo> <mi>z</mi> <mo>)</mo> </mrow> <msup> <mi>θ</mi> <mo>′</mo> </msup> <mo stretchy="false">(</mo> <mn>0</mn> <mo stretchy="false">)</mo> </mrow> <mrow> <mi>θ</mi> <mo stretchy="false">(</mo> <mo>-</mo> <mi>z</mi> <mo stretchy="false">)</mo> <mrow> <mi>θ</mi> <mo>(</mo> <mfrac> <msub> <mi>y</mi> <mi>l</mi> </msub> <mrow> <mn>2</mn> <mi>π</mi> <mi mathvariant="normal">i</mi> </mrow> </mfrac> <mo>)</mo> </mrow> </mrow> </mfrac> <mo>)</mo> <mo>×</mo> <mo>(</mo> <munder> <mo>∏</mo> <mi>k</mi> </munder> <mfrac> <mrow> <mrow> <mi>θ</mi> <mo>(</mo> <mfrac> <msub> <mi>e</mi> <mi>k</mi> </msub> <mrow> <mn>2</mn> <mi>π</mi> <mi mathvariant="normal">i</mi> </mrow> </mfrac> <mo>-</mo> <mo stretchy="false">(</mo> <msub> <mi>α</mi> <mi>k</mi> </msub> <mo>+</mo> <mn>1</mn> <mo stretchy="false">)</mo> <mi>z</mi> <mo>)</mo> </mrow> <mi>θ</mi> <mo stretchy="false">(</mo> <mo>-</mo> <mi>z</mi> <mo stretchy="false">)</mo> </mrow> <mrow> <mrow> <mi>θ</mi> <mo>(</mo> <mfrac> <msub> <mi>e</mi> <mi>k</mi> </msub> <mrow> <mn>2</mn> <mi>π</mi> <mi mathvariant="normal">i</mi> </mrow> </mfrac> <mo>-</mo> <mi>z</mi> <mo>)</mo> </mrow> <mi>θ</mi> <mo stretchy="false">(</mo> <mo>-</mo> <mo stretchy="false">(</mo> <msub> <mi>α</mi> <mi>k</mi> </msub> <mo>+</mo> <mn>1</mn> <mo stretchy="false">)</mo> <mi>z</mi> <mo stretchy="false">)</mo> </mrow> </mfrac> <mo>)</mo> </mrow> </math> <math display="block"> <mrow> <mi>π</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo stretchy="false">)</mo> <mo>=</mo> <munderover> <mo>∑</mo> <mrow> <mi>m</mi> <mo>=</mo> <mn>2</mn> </mrow> <mi>n</mi> </munderover> <mrow> <mo>⌊</mo> <msup> <mrow> <mo>(</mo> <mrow> <munderover> <mo>∑</mo> <mrow> <mi>k</mi> <mo>=</mo> <mn>1</mn> </mrow> <mrow> <mi>m</mi> <mo>-</mo> <mn>1</mn> </mrow> </munderover> <mrow> <mo minsize="1.5">⌊</mo> <mo>(</mo> <mi>m</mi> <mo>/</mo> <mi>k</mi> <mo>)</mo> <mo minsize="2">/</mo> <mo>⌈</mo> <mi>m</mi> <mo>/</mo> <mi>k</mi> <mo>⌉</mo> <mo minsize="1.5">⌋</mo> </mrow> </mrow> <mo>)</mo> </mrow> <mrow> <mo>-</mo> <mn>1</mn> </mrow> </msup> <mo>⌋</mo> </mrow> </mrow> </math> <math display="block"> <mrow> <msub> <mrow> <mo>‖</mo> <mi>ϕ</mi> <mo>‖</mo> </mrow> <mrow> <msubsup> <mi>W</mi> <mi>s</mi> <mi>k</mi> </msubsup> <mo stretchy="false">(</mo> <msub> <mi>Ω</mi> <mi>g</mi> </msub> <mo stretchy="false">)</mo> </mrow> </msub> <mo>≝</mo> <msup> <mrow> <mo>(</mo> <munder> <mo>∑</mo> <mrow> <mo>|</mo> <mi>α</mi> <mo>|</mo> <mo>≦</mo> <mi>k</mi> </mrow> </munder> <msubsup> <mfenced close="‖" open="‖"> <mfrac> <mrow> <msup> <mo>∂</mo> <mi>α</mi> </msup> <mi>ϕ</mi> </mrow> <mrow> <mo>∂</mo> <msup> <mi>ξ</mi> <mi>α</mi> </msup> </mrow> </mfrac> </mfenced> <mrow> <msup> <mi>L</mi> <mi>s</mi> </msup> <mo stretchy="false">(</mo> <msub> <mi>Ω</mi> <mi>g</mi> </msub> <mo stretchy="false">)</mo> </mrow> <mi>s</mi> </msubsup> <mo>)</mo> </mrow> <mrow> <mn>1</mn> <mo>/</mo> <mi>s</mi> </mrow> </msup> </mrow> </math></p> +<p>想要看更多的範例你可以點 <a href="./">MathML Project</a> 頁面的任一連結; 如果你有在編譯自己的版本,可以看一下這個資料夾 + <i> + mozilla/layout/mathml/tests</i> + 。</p> +<p>所以你可以做些什麼呢? 你在 Mozilla 上使用時有沒有遇到任何 MathML 標準是沒正常運作的? 或者是一些煩人的東西你覺得需要改進? 或是你之前做的某些東西沒辦法正常運作了(像是 <em>迴歸</em> )? 如果有遇到這些狀況,快去 BugZilla 回報這些異常吧。BugZilla 世有辦法收錄這些東西的。而且,如果你遇到問題不回報,我們也沒辦法去修正啊?!</p> +<p>如果你想要讓 Gecko 成為一個更精巧更完善的 MathML 繪製引擎,<a href="https://developer.mozilla.org/en-US/docs/get-involved.html">加入我們</a>。 你的回應可以以 網站上的 MathML 內容呈現、或者去 <a href="https://developer.mozilla.org/en-US/docs/quality/bug-writing-guidelines.html">BugZilla</a> 回報錯誤。或者,如果你能在在程式碼方面提供協助, 來 <a href="http://lxr.mozilla.org/seamonkey/source/layout/mathml/">檢查或改進目前的程式碼</a> , 或者是處理我們<a href="https://developer.mozilla.org/en-US/docs/Mozilla/MathML_Project/update.html">待處理清單</a>的項目。</p> +<div id="cke_pastebin" style="position: absolute; top: 1775.63px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> + </div> diff --git a/files/zh-tw/mozilla/performance/about_colon_memory/index.html b/files/zh-tw/mozilla/performance/about_colon_memory/index.html new file mode 100644 index 0000000000..f9895899dd --- /dev/null +++ b/files/zh-tw/mozilla/performance/about_colon_memory/index.html @@ -0,0 +1,188 @@ +--- +title: 'about:memory' +slug: 'Mozilla/Performance/about:memory' +translation_of: 'Mozilla/Performance/about:memory' +--- +<p>about:memory 在Firefox 裡是個特別分頁可讓你你看、存、讀、Firefox 的記憶體處理詳細測量出的差異。 此頁也讓你進行其他記憶體相關的操作例如觸發垃圾回收 (GC) 和循環回收 (CC)、轉存 GC & CC 紀錄和轉存無效堆疊偵測 ( DMD) 報告。 此頁出現在所有版本且不須任何準備即可用它。</p> + +<h2 id="如何產生記憶體報告">如何產生記憶體報告</h2> + +<p>讓我們假設你想去量測 Firefox 的記憶體使用量。 或許你想自己去調查它、也或許某人要球你使用 about:memory 去產生"記憶體報告"以讓他們可以研究你碰到的問題。 跟著下列步驟走:</p> + +<ul> + <li>在意的那刻 起(例如只要 Firefox's 記憶體用量偏高了) 在網址欄開新分頁且輸入 "about:memory" 並按下 "Enter".</li> + <li>如果你正在用的交流管道可傳送檔案,例如 Bugzilla 或 email,按在 "Measure and save..." 按鈕。 將打開一個檔案交談窗讓你存記憶體報告成一個你指定的檔案。 (檔名將有 <code>.json.gz</code> 的副檔名) 你可以順便附加或上傳。接受者將能在他們的 Firefox 中看到 about:memory 中的內容。</li> + <li>如你可用的交流管道只有文字可被傳送,例如在網站的意見條中,按在 "Measure..." 按鈕。 這將會造成 about:memory 中樹狀結構目錄文字產生。這個結構只有文字,所以你可以複製貼上部份或全部的文字到任何種類的文字欄(你不必進行擷圖)。這文字包含一些比 memory reports 檔較少的量測值,但通常已經足夠去診斷問題。不要重複地按下 "Measure..." ,因為這將造成 about:memory 記憶體用量提高,由於它釋放並產生大量的文件物件模型(DOM) 節點。</li> +</ul> + +<p>注意在兩個例子中產生的資料含有私人敏感的細節例如你開在其他分頁的完整清單。如果你不想分享這些訊息,你可以選擇 "anonymize" 核取格,在按下 "Measure and save..." 或 "Measure..."之前。 這將造成私人敏感資料被剝掉,但也可能會造成其他人難以去研究記憶體用量。</p> + +<h2 id="從檔案讀取記憶體報告">從檔案讀取記憶體報告</h2> + +<p>最簡單的方法從檔案讀取記憶體報告就是用 "Load..." 按鈕。 你也可以用 "Load and diff..." 按鈕去獲得在兩個記憶體報告檔中的差異。</p> + +<p>單一記憶體報告檔也可以自動被讀取,當附加一個檔案查詢字串,例如:</p> + +<pre>about:memory?file=/home/username/reports.json.gz +</pre> + +<p>這是從其他Firefox裝置系統讀取記憶體報告檔最有用的。</p> + +<p>記憶體報告被儲存到壓縮的格式 (gzipped JSON)。 這些檔案可以被直接讀或解壓縮後讀入。</p> + +<h2 id="解釋記憶體報告">解釋記憶體報告</h2> + +<p>幾乎在 about:memory 中你看到東西都有工具提示的解釋。停留在任何按鈕將看到它作用的描述。停留在任何文字量測值上將看到它意義的描述。</p> + +<h3 id="量測基本"><span class="mw-headline" id="Basics">量測基本</span></h3> + +<p>大多數量測使用位元組為他們的單位,但某些是百分比計算。</p> + +<p>多數量測值表示在樹狀目錄結構中。例如:</p> + +<pre> 585 (100.0%) -- preference-service + └──585 (100.0%) -- referent + ├──493 (84.27%) ── strong + └───92 (15.73%) -- weak + ├──92 (15.73%) ── alive + └───0 (00.00%) ── dead +</pre> + +<p>枝葉節點表示實際量測值:每個內部節點值是子節點的總和。</p> + +<p>樹狀目錄的使用允許量測值分成進一步的目錄、次目錄、次次目錄…….如果需要可到任意深度。一個目錄中所有的量測值不會重疊。</p> + +<p>樹狀可以用斜線 '/' 作為分隔符號被描寫。 例如, <code>preference/referent/weak/dead</code> 表示上列中到最後枝葉節點的路徑。</p> + +<p>次目錄按它可以被縮起或展開。如果你發現任何特別的樹狀目錄,這可以幫你馬上縮起主根下所有分枝,然後慢慢展開感興趣的。</p> + +<h3 id="報告區間_Sections"><span class="mw-headline" id="Sections">報告區間 Sections</span></h3> + +<p>記憶體報告依照每個預處理原則、每個區間一個程序被顯示,在每個程序的量測值中,還有更多小區間。</p> + +<h4 id="Explicit_Allocations">Explicit Allocations</h4> + +<p>這個區間包含一個單一樹狀目錄,叫做 "explicit",量測所有經由表層呼叫(explicit calls)去堆疊配置函數和非堆疊配置函數(例如 <code>mmap</code> and <code>VirtualAlloc</code>)的記憶體。</p> + +<p>這裡是瀏覽器區間的例子,分頁打開了 cnn.com、 techcrunch.com、 和 arstechnica.com。不同的次目錄被展開,其他的因展示緣故被縮起。</p> + +<pre>191.89 MB (100.0%) -- explicit +├───63.15 MB (32.91%) -- window-objects +│ ├──24.57 MB (12.80%) -- top(http://edition.cnn.com/, id=8) +│ │ ├──20.18 MB (10.52%) -- active +│ │ │ ├──10.57 MB (05.51%) -- window(http://edition.cnn.com/) +│ │ │ │ ├───4.55 MB (02.37%) ++ js-compartment(http://edition.cnn.com/) +│ │ │ │ ├───2.60 MB (01.36%) ++ layout +│ │ │ │ ├───1.94 MB (01.01%) ── style-sheets +│ │ │ │ └───1.48 MB (00.77%) -- (2 tiny) +│ │ │ │ ├──1.43 MB (00.75%) ++ dom +│ │ │ │ └──0.05 MB (00.02%) ── property-tables +│ │ │ └───9.61 MB (05.01%) ++ (18 tiny) +│ │ └───4.39 MB (02.29%) -- js-zone(0x7f69425b5800) +│ ├──15.75 MB (08.21%) ++ top(http://techcrunch.com/, id=20) +│ ├──12.85 MB (06.69%) ++ top(http://arstechnica.com/, id=14) +│ ├───6.40 MB (03.33%) ++ top(chrome://browser/content/browser.xul, id=3) +│ └───3.59 MB (01.87%) ++ (4 tiny) +├───45.74 MB (23.84%) ++ js-non-window +├───33.73 MB (17.58%) ── heap-unclassified +├───22.51 MB (11.73%) ++ heap-overhead +├────6.62 MB (03.45%) ++ images +├────5.82 MB (03.03%) ++ workers/workers(chrome) +├────5.36 MB (02.80%) ++ (16 tiny) +├────4.07 MB (02.12%) ++ storage +├────2.74 MB (01.43%) ++ startup-cache +└────2.16 MB (01.12%) ++ xpconnect</pre> + +<p>某些專家才需要瞭解這裡所有的細節,但有很多東西值得解釋。</p> + +<ul> + <li>這個 "explicit" 值在樹狀圖的根表示所有記憶體經由explicit call 去配置函數。</li> + <li> "window-objects" 次目錄表示所有 JavaScript 視窗物件, 包括瀏覽器分頁和使用者界面視窗。 例如, "top(http://edition.cnn.com/, id=8)" 次目錄表示分頁打開到 cnn.com,且 "top(chrome://browser/content/browser.xul, id=3)" 表示主瀏覽器 UI 視窗。</li> + <li>在每個視窗的有次目錄關於 JavaScript ("js-compartment(...)" 和 "js-zone(...)")、 layout、 style-sheets、 the DOM, and other things.</li> + <li>很清楚的分頁一 cnn.com 用更多記憶體於分頁二 techcrunch.com ,二又用更多記憶體於分頁三 arstechnica.com 。</li> + <li>次目錄有個名字叫 "(2 tiny)" 是人工節點預設允許不重要的次目錄縮起來。如果在測量前你將額外資訊 "verbose" 核取盒勾起, 所有目錄將完全展開並且沒有人工節點被插入。</li> + <li> "js-non-window" 次目錄表示 JavaScript 記憶體用量不從視窗來而來自瀏覽器核心。</li> + <li> "heap-unclassified" 值表示堆疊配置的記憶體( heap-allocated memory) 它是不被任何記憶體記錄列量測的。通常是 "explicit" 的 10--20% 。 如果它偏高,也表示該多加個記憶體紀錄列。無效堆疊偵測 (<a href="/en-US/docs/Mozilla/Performance/DMD" title="Performance/MemShrink/DMD">DMD)</a> 可被用來決定哪些記憶體報告列該被添加。</li> + <li>有其他量測值有其他內容例如 images 和 workers,和瀏覽器次系統像啟動快取 Startup cache 和 XPConnect.</li> +</ul> + +<p>某些附加元件 add-ons 的記憶體用量有識別性, 像下列例子所示:</p> + +<pre>├───40,214,384 B (04.17%) -- add-ons +│ ├──21,184,320 B (02.20%) ++ {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}/js-non-window/zones/zone(0x100496800)/compartment([System Principal], jar:file:///Users/njn/Library/Application%20Support/Firefox/Profiles/puna0zr8.new/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/bootstrap.js (from: resource://gre/modules/addons/XPIProvider.jsm:4307)) +│ ├──11,583,312 B (01.20%) ++ jid1-xUfzOsOFlzSOXg@jetpack/js-non-window/zones/zone(0x100496800) +│ ├───5,574,608 B (00.58%) -- {59c81df5-4b7a-477b-912d-4e0fdf64e5f2} +│ │ ├──5,529,280 B (00.57%) -- window-objects +│ │ │ ├──4,175,584 B (00.43%) ++ top(chrome://chatzilla/content/chatzilla.xul, id=4293) +│ │ │ └──1,353,696 B (00.14%) ++ top(chrome://chatzilla/content/output-window.html, id=4298) +│ │ └─────45,328 B (00.00%) ++ js-non-window/zones/zone(0x100496800)/compartment([System Principal], file:///Users/njn/Library/Application%20Support/Firefox/Profiles/puna0zr8.new/extensions/%7B59c81df5-4b7a-477b-912d-4e0fdf64e5f2%7D/components/chatzilla-service.js) +│ └───1,872,144 B (00.19%) ++ treestyletab@piro.sakura.ne.jp/js-non-window/zones/zone(0x100496800)</pre> + +<p>更多細節值得解釋如下:</p> + +<ul> + <li>某些附加元件以名子被識別,像 Tree Style Tab。 其他的僅用16進位識別字。 你可以去看 about:support 裡哪個添入列特別識別字屬於那類。例如, <code>59c81df5-4b7a-477b-912d-4e0fdf64e5f2</code> 屬於 Chatzilla 。</li> + <li>所有 JavaScript 記憶體用量由附加元件來的被量測並顯示在次目錄中。</li> + <li>附加元件使用不同視窗,例如 Chatzilla,這些視窗的記憶體用量將顯示在不同次目錄。</li> + <li>自附加元件使用 XUL overlays覆蓋的,如 AdBlock Plus, 這些覆蓋的記憶體使用量將不顯示在這個次目錄中; 它將反而在 non-add-on 次目錄且將不像由附加元件所造成的那般是可識別的。</li> +</ul> + +<h4 id="其他量測值">其他量測值</h4> + +<p>這個區間包含多目錄,包括許多在 "explicit" 目錄中橫跨的量測值。 例如, 在 "explicit"目錄所有的 DOM 和 layout 量測值是被打散成一個又一個視窗, 但在 "Other Measurements" 這些量測值是整合為由整個瀏覽器來的總和, 如下例所示:</p> + +<pre>26.77 MB (100.0%) -- window-objects +├──14.59 MB (54.52%) -- layout +│ ├───6.22 MB (23.24%) ── style-sets +│ ├───4.00 MB (14.95%) ── pres-shell +│ ├───1.79 MB (06.68%) ── frames +│ ├───0.89 MB (03.33%) ── style-contexts +│ ├───0.62 MB (02.33%) ── rule-nodes +│ ├───0.56 MB (02.10%) ── pres-contexts +│ ├───0.47 MB (01.75%) ── line-boxes +│ └───0.04 MB (00.14%) ── text-runs +├───6.53 MB (24.39%) ── style-sheets +├───5.59 MB (20.89%) -- dom +│ ├──3.39 MB (12.66%) ── element-nodes +│ ├──1.56 MB (05.84%) ── text-nodes +│ ├──0.54 MB (02.03%) ── other +│ └──0.10 MB (00.36%) ++ (4 tiny) +└───0.06 MB (00.21%) ── property-tables</pre> + +<p>在這區間的某些目錄量測那些在 "explicit" 目錄中不是橫跨目錄的量測值,例如在上上個例子中的這個 "preference-service" 。</p> + +<p>最後, 在這區間結尾是獨立的量測值, 如下例所示:</p> + +<pre> 0.00 MB ── canvas-2d-pixels + 5.38 MB ── gfx-surface-xlib + 0.00 MB ── gfx-textures + 0.00 MB ── gfx-tiles-waste + 0 ── ghost-windows + 109.22 MB ── heap-allocated + 164 ── heap-chunks + 1.00 MB ── heap-chunksize + 114.51 MB ── heap-committed + 164.00 MB ── heap-mapped + 4.84% ── heap-overhead-ratio + 1 ── host-object-urls + 0.00 MB ── imagelib-surface-cache + 5.27 MB ── js-main-runtime-temporary-peak + 0 ── page-faults-hard + 203,349 ── page-faults-soft + 274.99 MB ── resident + 251.47 MB ── resident-unique +1,103.64 MB ── vsize</pre> + +<p>某些量測值標示如下:</p> + +<ul> + <li>"resident" 常駐記憶體. 實體記憶體用量。 如你想要單一量測值去總計記憶體用量, 這也許是最好的選擇。</li> + <li>"vsize". 虛擬記憶體用量。 這通常高於任一個其他量測值 (特別在 Mac 上)。 唯有它是問題在 32 位元平台例如 Win32。 也有 "vsize-max-contiguous" (在所有平台上不量測的且在此例中不顯示), 它指出可用虛擬記憶體空間中最大的一塊。 如果這數值很低, 或許不久之後記憶體配置將失敗由於缺乏虛擬位址空間。</li> + <li>許多繪圖顯示相關量測值 ("gfx-*")。 這些值在平台上是佔大量的。 顯示相關通常是高記憶體用量的來源, 所以這些量測職能幫助偵測這些案例。</li> +</ul> + +<h4 id="系統_System">系統 System</h4> + +<p>這區間只顯示在Firefox OS。 它包含全裝置從操作系統所測得值。在其之中, 這些區間有助於精確瞭解裝置的記憶體如何被使用。</p> + +<p>......翻譯完雖然瞭解不少,卻僅知哪些資訊可以給改善者參考,要解決使用者記憶體的問題,還是建議各位設計師可以整合One Tab之類的軟體,限制記憶體使用例如最大800MB,如果超過了,依使用者習慣分為100個分頁中有20個維持開啟活動、剩下的逐步變成例如完整保存的網頁檔之類,平時留個分頁籤名字只是看看而已,點到了才載入,就不會讓人難忍受了,也不會吃太多記憶體就依照個人使用狀況自行分配就好,畢竟閒置的除了影像外,很多只是在播放廣告,一點感想。</p> diff --git a/files/zh-tw/mozilla/performance/index.html b/files/zh-tw/mozilla/performance/index.html new file mode 100644 index 0000000000..f8261ab133 --- /dev/null +++ b/files/zh-tw/mozilla/performance/index.html @@ -0,0 +1,130 @@ +--- +title: Performance +slug: Mozilla/Performance +tags: + - NeedsTranslation + - Performance + - TopicStub +translation_of: Mozilla/Performance +--- +<p>被連接到此的這篇文章將幫助你改進效能,不論你是開發 Mozilla 核心碼或附加元件。</p> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h3 id="Documentation">Documentation</h3> + + <dl> + <dt><a href="/en/Performance/Reporting_a_Performance_Problem" title="en/Performance/Reporting_a_Performance_Problem">回報性能問題 Rorting a Performance Problem</a></dt> + <dd>對使用者友善的指導以報告性能問題。不需要開發環境。</dd> + <dt><a href="/en/Extensions/Performance_best_practices_in_extensions" title="en/Extensions/Performance best practices in extensions">性能最好的實踐在擴充元件中</a></dt> + <dd>給擴充元件開發者性能"最好的實踐"指引。</dd> + <dt><a href="/en/Performance/Measuring_add-on_startup_performance" title="en/Measuring Add-on Startup Performance">測量附加元件啟動效能</a></dt> + <dd>給附加元件開發者指引如何設定測試環境。</dd> + <dt><a href="/en/XUL_School/Appendix_A:_Add-on_Performance" title="en/XUL School/Appendix A: Add-on Performance">XUL School: 附加元件效能</a></dt> + <dd>給附加元件開發者提示去幫他們避免損害應用效能。</dd> + <dt><a href="/en/Performance/GPU_performance" title="en/GPU performance">GPU 效能</a></dt> + <dd>當使用GPU時給研究和改進效能的可靠建議</dd> + </dl> + + <p><span class="alllinks"><a class="internal" href="/Special:Tags?tag=Performance" title="Special:Tags?tag=Performance">查看所有頁面以 "Performance" 標籤的...</a></span></p> + + <h3 id="記憶體研究和漏洞偵測工具">記憶體研究和漏洞偵測工具</h3> + + <dl> + <dt><a href="/en-US/docs/Mozilla/Performance/about:memory">about:memory</a></dt> + <dd>about:memory 是最輕巧使用工具給量測記憶體用量使用在 Mozilla 程式碼,且是最好出發地。它也讓你進行其他記憶體相關的操作像觸發垃圾回收 (GC) 和循環回收 (CC)、轉存 GC & CC 紀錄和轉存無效堆疊偵測 ( DMD) 報告。 about:memory 是建立在 Firefox's <a href="/en-US/docs/Mozilla/Performance/Memory_reporting">memory reporting</a> 構造上.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/DMD">DMD</a></dt> + <dd>無效堆疊偵測 (DMD) 是個可識別在about:memory中的量測值問題點,而且可以作各式各樣的一般堆疊研究。</dd> + <dt><a href="https://areweslimyet.com/">areweslimyet.com</a></dt> + <dd>areweslimyet.com (又名 AWSY) 是記憶體用和回歸偵測系統。</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/BloatView">BloatView</a></dt> + <dd>BloatView 在配置和引用計數時列印按類別統計資料,且依類別提供記憶體中洩漏的分解總數目。它常用為 Mozilla持續整合測試的一部分。</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Refcount_tracing_and_balancing">引用計數追蹤與平衡 </a></dt> + <dd>引用計數追蹤與平衡是個手段要追蹤由引用計數不正確的使用造成的洩漏。 他們遲緩又不那麼容易使用,且因此大多數適合專家級開發者使用。</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/GC_and_CC_logs">GC and CC logs</a></dt> + <dd>觸發垃圾回收 (GC) 和循環回收 (CC)紀錄可被產生與分析以不同方式。特別是,他們能幫助瞭解為何特定勿建一直保持存在記憶體。</dd> + <dt><a href="/en-US/docs/Mozilla/Testing/Valgrind">Valgrind</a></dt> + <dd><a class="external text" href="http://valgrind.org/" rel="nofollow">Valgrind</a> 是個即時偵測種種記憶體相關的問題含洩漏的工具。 Valgrind 常作為Mozilla's持續整合測試的 <a class="external text" href="/en-US/docs/Valgrind_test_job" rel="nofollow">部份</a> ,雖然Valgrind的遲緩讓應用範圍受限。</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Testing/Firefox_and_Address_Sanitizer#LeakSanitizer">LeakSanitizer</a></dt> + <dd><span class="external text">LeakSanitizer</span> (又叫 LSAN) 相似於 Valgrind。 但它跑得快一些因為它使用靜態來源碼架構。LSAN常作為Mozilla's持續整合測試的一部分,雖然多數測試執行時它也是 AddressSanitizer (又叫 ASAN) 測試工作的一部分。</dd> + <dt><a href="http://developer.apple.com/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html">Apple tools</a></dt> + <dd>Apple provides <span class="external text">some tools</span> for Mac OS X that report similar problems to those reported by LSAN and Valgrind. The "leaks" tool is not recommended for use with SpiderMonkey or Firefox, because it gets confused by tagged pointers and thinks objects have leaked when they have not (see <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=390944" rel="nofollow">bug 390944</a>).</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Leak_Gauge">Leak Gauge</a></dt> + <dd>Leak Gauge is a tool that can be used to detect certain kinds of leaks in Gecko, including those involving documents, window objects, and docshells.</dd> + <dt><a href="http://dxr.mozilla.org/mozilla-central/source/memory/replace/logalloc/README">LogAlloc</a></dt> + <dd>LogAlloc is a tool that dumps a log of memory allocations in Gecko. That log can then be replayed against Firefox's default memory allocator independently or through another replace-malloc library, allowing the testing of other allocators under the exact same workload.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Memory_Profiler">Memory Profiler</a></dt> + <dd>The memory profiler samples allocation events and provides different views to analyze the allocation characteristic.</dd> + </dl> + + <p>See also the documentation on <a href="/en-US/docs/Mozilla/Performance/Leak-hunting_strategies_and_tips">Leak-hunting strategies and tips.</a></p> + </td> + <td> + <h3 id="Profiling_and_performance_tools">Profiling and performance tools</h3> + + <dl> + <dt><a href="https://developer.mozilla.org/en-US/docs/Tools/Performance" title="en/Performance/Profiling with the Built-in Profiler">Profiling with the Developer Tools Profiler</a></dt> + <dd>The profiler built into the developer tools has a high-level waterfall, detailed call tree, allocations and GC profiling, and flame graphs. It is available on all platforms and release channels, and also supports remote profiling b2g and Fennec.</dd> + </dl> + + <dl> + <dt><a href="/en/Performance/Profiling_with_the_Built-in_Profiler" title="en/Performance/Profiling with the Built-in Profiler">Profiling with the Gecko Profiler Addon</a> {{ gecko_minversion_inline("16.0") }}</dt> + <dd>The Gecko Profiler Addon is a good tool to start with.</dd> + <dt><a href="/en/Performance/Profiling_with_Instruments" title="en/Performance/Profiling with Instruments">Profiling with Instruments</a></dt> + <dd>How to use Apple's Instruments tool to profile Mozilla code.</dd> + <dt><a href="/en/Performance/Profiling_with_Xperf" title="en/Performance/Profiling with Xperf">Profiling with Xperf</a></dt> + <dd>How to use Microsoft's Xperf tool to profile Mozilla code.</dd> + <dt><a href="/en-US/docs/Performance/Profiling_with_Concurrency_Visualizer" title="en/Performance/Profiling with Concurrency Visualizer">Profiling with Concurrency Visualizer</a></dt> + <dd>How to use Visual Studio's Concurrency Visualizer tool to profile Mozilla code.</dd> + <dt><a href="/en/Performance/Profiling_with_Zoom" title="en/Performance/Profiling with Zoom">Profiling with Zoom</a></dt> + <dd>Zoom is a profiler for Linux done by the people who made Shark</dd> + <dt><a href="/en/Performance/Measuring_performance_using_the_PerfMeasurement.jsm_code_module" title="en/Performance/Measuring performance using the PerfMeasurement.jsm code module">Measuring performance using the PerfMeasurement.jsm code module</a> {{ gecko_minversion_inline("2.0") }}</dt> + <dd>Using <a href="/en/JavaScript_code_modules/PerfMeasurement.jsm" title="en/JavaScript code modules/PerfMeasurement.jsm"><code>PerfMeasurement.jsm</code></a> to measure performance data in your JavaScript code.</dd> + <dt><a href="/en-US/docs/Performance/Adding_a_new_Telemetry_probe" title="https://developer.mozilla.org/en-US/docs/Performance/Adding_a_new_Telemetry_probe">Adding a new Telemetry probe</a></dt> + <dd>Information on how to add a new measurement to the Telemetry performance-reporting system</dd> + <dt><a href="/en/Performance/Profiling_JavaScript_with_Shark" title="en/Performance/Profiling JavaScript with Shark">Profiling JavaScript with Shark</a> {{ gecko_minversion_inline("1.9") }}</dt> + <dd>How to use the Mac OS X Shark profiler to profile JavaScript code in Firefox 3.5 or later.</dd> + <dt><a href="/en/Performance/Profiling_with_Shark" title="en/Performance/Profiling with Shark">Profiling with Shark</a></dt> + <dd>How to use Apple's Shark tool to profile Mozilla code.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Investigating_CSS_Performance">Investigating CSS Performance</a></dt> + <dd>How to figure out why restyle is taking so long</dd> + </dl> + + <h3 id="Power_profiling">Power profiling</h3> + + <dl> + <dt><a href="/en-US/docs/Mozilla/Performance/Power_profiling_overview">Power profiling overview</a></dt> + <dd>This page provides an overview of relevant information, including details about hardware, what can be measured, and recommended approaches. It should be the starting point for anybody new to power profiling.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/tools_power_rapl">tools/power/rapl</a></code> (Mac, Linux)</dt> + <dd><code>tools/power/rapl</code> is a command-line utility in the Mozilla codebase that uses the Intel RAPL interface to gather direct power estimates for the package, cores, GPU and memory.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/powermetrics">powermetrics</a></code> (Mac-only)</dt> + <dd><code>powermetrics</code> is a command-line utility that gathers and displays a wide range of global and per-process measurements, including CPU usage, GPU usage, and various wakeups frequencies.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/TimerFirings_logging">TimerFirings logging</a> (All platforms)</dt> + <dd>TimerFirings logging is a built-in logging mechanism that prints data on every time fired.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/dtrace">dtrace</a></code> (Mac-only)</dt> + <dd><code>dtrace</code> is a powerful kernel instrumentation tool. One of its many features is the ability to instrument wakeups in a high-context fashion.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Activity_Monitor_and_top">Activity Monitor, Battery Status Menu and <code>top</code></a> (Mac-only)</dt> + <dd>The battery status menu, Activity Monitor and <code>top</code> are three related Mac tools that have major flaws but often consulted by users, and so are worth understanding.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Intel_Power_Gadget">Intel Power Gadget</a> (Windows, Mac, Linux)</dt> + <dd>Intel Power Gadget provides real-time graphs for package and processor RAPL estimates. It also provides an API through which those estimates can be obtained.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/perf">perf</a></code> (Linux-only)</dt> + <dd><code>perf</code> is a powerful command-line utility that can measure many different things, including energy estimates and high-context measurements of things such as wakeups.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/turbostat">turbostat</a></code> (Linux-only)</dt> + <dd><code>turbostat</code> is a command-line utility that gathers and displays various power-related measurements, with a focus on per-CPU measurements such as frequencies and C-states.</dd> + <dt><code><a href="https://01.org/powertop">powertop</a></code> (Linux-only)</dt> + <dd><code>powertop</code> is an interactive command-line utility that gathers and displays various power-related measurements.</dd> + </dl> + + <h3 id="Related_Topics">Related Topics</h3> + + <dl> + <dd><a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>, <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a>, <a href="/En/Developer_Guide" title="en/Developing_Mozilla">Developing Mozilla</a>, <a href="/en/Extensions" title="en/Extensions">Extensions</a>, <a href="/en/Addons" title="en/Addons">Addons</a></dd> + </dl> + </td> + </tr> + </tbody> +</table> + +<p> </p> diff --git a/files/zh-tw/mozilla/preferences/index.html b/files/zh-tw/mozilla/preferences/index.html new file mode 100644 index 0000000000..1169ecabf1 --- /dev/null +++ b/files/zh-tw/mozilla/preferences/index.html @@ -0,0 +1,48 @@ +--- +title: Preferences +slug: Mozilla/Preferences +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Preferences +--- +<p>The preference system makes it possible to store data for Mozilla applications using a key/value pairing system. These articles provide information about how to use the preference system.</p> +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="Documentation" name="Documentation">Documentation</h2> + <dl> + <dt><a href="/en-US/docs/Preferences/Preferences_system" title="Preferences/Preferences system">Preferences system</a></dt> + <dd>An introduction to using the preference system in Mozilla.</dd> + <dt><a href="/en-US/docs/XUL_School/Handling_Preferences" title="XUL School/Handling Preferences">XUL School: Handling preferences</a></dt> + <dd>The XUL School tutorial chapter on preferences.</dd> + <dt><a href="/en-US/docs/Preferences/Preference_reference" title="Preferences/Preference_reference">Mozilla preference reference</a></dt> + <dd>A reference guide to all Mozilla preferences; currently a work in progress.</dd> + <dt><a href="/en-US/docs/Preferences/A_brief_guide_to_Mozilla_preferences" title="Preferences/A brief guide to Mozilla preferences">A brief guide to Mozilla preferences</a></dt> + <dd>An introductory guide to where preferences are stored and other useful information about the core preference system.</dd> + <dt><a href="/en-US/docs/Preferences/Using_preferences_from_application_code" title="Preferences/Using preferences from application code">Using preferences from application code</a> {{gecko_minversion_inline("6.0")}}</dt> + <dd>Firefox 6 introduced static functions for accessing preferences efficiently from within application code. This API is not available for add-ons, but if you're working on a Gecko application, this API is the preferred way to access preferences.</dd> + <dt><a href="/en-US/docs/Preferences/Mozilla_networking_preferences" title="Preferences/Mozilla networking preferences">Mozilla networking preferences</a></dt> + <dd>A guide to key networking-related preferences.</dd> + <dt><a href="/en-US/docs/Preferences/Mozilla_preferences_for_uber-geeks" title="Preferences/Mozilla preferences for uber-geeks">Mozilla preferences for uber-geeks</a></dt> + <dd>A guide to preferences that only truly elite geeks should play with.</dd> + </dl> + <p><span class="alllinks"><a href="/en-US/docs/tag/Preferences" title="tag/Preferences">View all pages tagged with "Preferences"...</a></span></p> + </td> + <td> + <h2 class="Community" id="Examples" name="Examples">Examples</h2> + <dl> + <dt><a href="/en-US/docs/Code_snippets/Preferences" title="Code snippets/Preferences">Code snippets</a></dt> + <dd>Preference-related code snippets.</dd> + <dt><a href="/en-US/docs/Adding_preferences_to_an_extension" title="Adding preferences to an extension">Adding preferences to an extension</a></dt> + <dd>How to add preferences to an existing extension.</dd> + </dl> + <h2 class="Related_Topics" id="Related_Topics" name="Related_Topics">Related Topics</h2> + <ul> + <li><a href="/en-US/docs/XUL" title="XUL">XUL</a>, <a href="/en-US/docs/JavaScript" title="JavaScript">JavaScript</a>, <a href="/en-US/docs/XPCOM" title="XPCOM">XPCOM</a>, <a href="/en-US/docs/Extensions" title="Extensions">Extensions</a>, <a href="/en-US/docs/Developer_Guide" title="Developing_Mozilla">Developing Mozilla</a></li> + </ul> + </td> + </tr> + </tbody> +</table> diff --git a/files/zh-tw/mozilla/preferences/preferences_system/index.html b/files/zh-tw/mozilla/preferences/preferences_system/index.html new file mode 100644 index 0000000000..965cd97480 --- /dev/null +++ b/files/zh-tw/mozilla/preferences/preferences_system/index.html @@ -0,0 +1,40 @@ +--- +title: Preferences system +slug: Mozilla/Preferences/Preferences_system +tags: + - NeedsTranslation + - Preferences system + - TopicStub + - XUL +translation_of: Mozilla/Preferences/Preferences_system +--- +<p>This document describes Toolkit's preferences system. Using this system it is possible to create preferences windows that display and operate appropriately on various platforms (Windows, MacOS X and GNOME).</p> + +<p>The system is implemented through a few <a href="/en/XUL" title="en/XUL">XUL</a> elements and attributes. Reference information about them is available below:</p> +<div class="moreinfo"> <p><strong><a href="/en-US/docs/Preferences_System">Preferences System</a> documentation:</strong></p> <ul> <li>Introduction: <a href="/en-US/docs/Preferences_System/Getting_Started">Getting Started</a> | <a href="/en-US/docs/Preferences_System/Examples">Examples</a> | <a href="/en-US/docs/Preferences_System/Troubleshooting">Troubleshooting</a></li> <li>Reference: <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/prefwindow" title="prefwindow">prefwindow</a></code> | <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/prefpane" title="prefpane">prefpane</a></code> | <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/preferences" title="preferences">preferences</a></code> | <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/preference" title="preference">preference</a></code> | <a href="/en-US/docs/Preferences_System/New_attributes">XUL attributes</a></li> </ul></div> +<h3 id="Use">Use</h3> +<p>Code for a typical preferences window may look like this:</p> +<pre><prefwindow id="appPreferences" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <prefpane id="pane1" label="&pane1.title;"> + <preferences> + <preference id="pref1" name="pref.name" type="bool"/> + </preferences> + + .. UI elements that refer to the preferences above, e.g.: + <checkbox id="check1" preference="pref1" + label="&check1.label;" accesskey="&check1.accesskey;"/> + </prefpane> + + <prefpane id="pane2" label="&pane2.title;" src="chrome://uri/to/pane.xul"/> +</prefwindow> +</pre> +<p>Pane content can be specified inline or an external chrome URI supplied for pane content to be loaded in via a dynamic overlay. You should be careful to read the <a class="external" href="http://en.wikipedia.org/wiki/Human_interface_guidelines" title="http://en.wikipedia.org/wiki/Human_interface_guidelines">HIGs</a> for the platforms you are targeting and use the XUL preprocessor if necessary to set different window titles as appropriate. You should also be careful to specify the width of the window (in em) as appropriate using the preprocessor for each targeted platform, as well as the height (in em) for platforms where the window size does not change as the selected panel is changed (e.g. Windows).</p> +<h3 id="Usage_in_XULRunner_applications" name="Usage_in_XULRunner_applications">Usage in XULRunner applications</h3> +<p>When calling openDialog() to open a preferences dialog, "toolbar" should be included in the features string. Not using "toolbar" will cause the preferences dialog to only display one preference pane.</p> +<p>Example:</p> +<pre class="eval">var features = "chrome,titlebar,toolbar,centerscreen,modal"; +window.openDialog(url, "Preferences", features); +</pre> +<h3 id="Bugzilla">Bugzilla</h3> +<p>The component for bugs in the Preferences bindings (but not in Firefox/Thunderbird Options UI) is Toolkit:Preferences (<a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Toolkit">file a bug</a> <a class="link-https" href="https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced&product=Toolkit&component=Preferences&resolution=---&chfieldto=Now">list open bugs</a>)</p> diff --git a/files/zh-tw/mozilla/preferences/preferences_system/new_attributes/index.html b/files/zh-tw/mozilla/preferences/preferences_system/new_attributes/index.html new file mode 100644 index 0000000000..f583b29b26 --- /dev/null +++ b/files/zh-tw/mozilla/preferences/preferences_system/new_attributes/index.html @@ -0,0 +1,55 @@ +--- +title: Preference XUL Attributes +slug: Mozilla/Preferences/Preferences_system/New_attributes +translation_of: Mozilla/Preferences/Preferences_system/New_attributes +--- +<p> </p> +<p><code><a href="/en-US/docs/XUL/prefwindow"><prefwindow></a></code> 裡的 Widgets 可能有下述屬性 (除此以外,尚有標準屬性).</p> +<h3 id="preference" name="preference">preference</h3> +<p>Specifies id of the linked <code><a href="/en-US/docs/XUL/preference"><preference></a></code> element. preference 和 widget 兩者的 <code>value</code> 將保持同步.</p> +<p>如下例,當 pane 被載入時, textbox 從名稱 extensions.example.mypref 的 preference 來自動初始化它的 <code>value</code> ;反過來說,當使用者改變 textbox 的 value 時,<code><preference></code>元素的 value 會同步更新,並將在適當的時候儲存至 preferences system.</p> +<pre class="eval"><preference id="my_pref" name="extensions.example.mypref" type="unichar"/> +<textbox preference="my_pref"/> +</pre> +<h3 id="preference-editable" name="preference-editable">preference-editable</h3> +<p>By default, the <code><a href="/en-US/docs/XUL/preference"><preference></a></code> element will automatically modify the value of a few standard widgets: checkbox, colorpicker, radiogroup, textbox, listitem, listbox, and menulist.</p> +<p>If you wish it to update the value of an element with different local name, for example your own XBL widget, you need to set the <code>preference-editable="true"</code> attribute on it.</p> +<p>For your widget to modify the <code><preference></code>'s value, you need to make sure a <code>change</code>, <code>command</code>, or <code>input</code> event is fired after the widget's value changes.</p> +<p><span class="comment">bug # or any testcases ? Note: this does not currently work on the tree widget. It may not work on anything so far (the API says it is to be available in version 1.8).</span></p> +<h3 id="onsyncfrompreference.2Fonsynctopreference" name="onsyncfrompreference.2Fonsynctopreference">onsyncfrompreference/onsynctopreference</h3> +<p>Often you will have UI whose construction does not map easily to a given preference type. 例如,你可能有一個 checkbox,當一個整數值是 3 時它被打勾,是 2 時不被打勾。為了初始化這個 UI 元素,你不能依賴預設的 initialization routine,因為這兩個數值對 checkbox 元素來說是無意義的. 你需要寫轉換函數來轉換 preference value 成 UI 元素可用的初始值,並且也轉換 UI 元素的 value 成某些格式來儲存至 preferences file. 這就是 onsyncfrompreference/onsynctopreference 的作用.</p> +<p><code>onsyncfrompreference</code> 被呼叫,當一個元素從 preferences 被初始化。 明確地說, 當一個 preference 元素的 value 被載入, 所有使用那個 preference 的元素將使他們的 <span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">onsyncfrompreference </span><span style="line-height: 1.5;">handler 被呼叫.</span></p> +<div class="warning"> + Be careful when writing <span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">onsyncfrompreference </span><span style="line-height: 1.5;">handlers. </span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;"><preference> </span><span style="line-height: 1.5;">elements defined after the preference<em> <strong>element</strong></em> being dealt with will not yet have their </span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">value</span><span style="line-height: 1.5;"> set, so referring to them from the handler will lead to a null result. Reorder the </span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;"><preference> </span><span style="line-height: 1.5;">elements or directly fetch the preference value via </span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">Services.prefs</span></div> +<p><span style="line-height: 1.5;">If you supply an implementation of this event, your implementation will be invoked during initialization and you can return the value with which to initialize the UI element with, or </span><code style="font-size: 14px;">undefined</code><span style="line-height: 1.5;"> to tell the preferences system to initialize the UI element with the default value (i.e. to attempt to initialize with the preference value). In the above example, you might write the checkbox like this:</span></p> +<pre><checkbox preference="foo.bar" onsyncfrompreference="return onsyncfrompreference();"/> + +.. script: +function onsyncfrompreference() +{ + var preference = document.getElementById("foo.bar"); + // .value === undefined means the preference is set to the default value + var actualValue = preference.value !== undefined ? + preference.value : preference.defaultValue; + // actualValue may be |null| here if the pref didn't have the default value. + return preference.value == 3; + + // If foo.bar was boolean and we wanted to use its value to initialize + // the checkbox, we could still implement this method if we wanted to + // perform any other initialization actions at this time. +} +</pre> +<p><code>onsynctopreference</code> is called when preferences are being written - the preferences system asks each element to translate its current state into a value suitable for writing to the specified preference. You can return a special value or <code>undefined</code> to tell the preferences system to use its standard means for obtaining the value. In the above example:</p> +<pre><checkbox preference="foo.bar" onsynctopreference="return onsynctopreference();"/> +.. script: +function onsynctopreference() +{ + var checkbox = document.getElementById("checkbox"); + return checkbox.checked ? 3 : 2; +} + +// If foo.bar was boolean and we wanted to use its value to write to +// preferences, we could still implement this method if we wanted to +// perform any other initialization actions at this time. +</pre> +<div class="moreinfo"> <p><strong><a href="/en-US/docs/Preferences_System">Preferences System</a> documentation:</strong></p> <ul> <li>Introduction: <a href="/en-US/docs/Preferences_System/Getting_Started">Getting Started</a> | <a href="/en-US/docs/Preferences_System/Examples">Examples</a> | <a href="/en-US/docs/Preferences_System/Troubleshooting">Troubleshooting</a></li> <li>Reference: <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/prefwindow" title="prefwindow">prefwindow</a></code> | <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/prefpane" title="prefpane">prefpane</a></code> | <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/preferences" title="preferences">preferences</a></code> | <code><a href="/zh-TW/docs/Mozilla/Tech/XUL/preference" title="preference">preference</a></code> | <a href="/en-US/docs/Preferences_System/New_attributes">XUL attributes</a></li> </ul></div> diff --git a/files/zh-tw/mozilla/projects/index.html b/files/zh-tw/mozilla/projects/index.html new file mode 100644 index 0000000000..7e832a9616 --- /dev/null +++ b/files/zh-tw/mozilla/projects/index.html @@ -0,0 +1,14 @@ +--- +title: Projects +slug: Mozilla/Projects +tags: + - Landing + - Mozilla + - NeedsContent + - NeedsTranslation + - Projects + - TopicStub +translation_of: Mozilla/Projects +--- +<p>Below you'll find links to documentation about various Mozilla projects; these are often parts of Firefox or other products, but may also be used in other projects as well.</p> +<p>{{ LandingPageListSubpages() }}</p> diff --git a/files/zh-tw/mozilla/projects/nss/getting_started_with_nss/index.html b/files/zh-tw/mozilla/projects/nss/getting_started_with_nss/index.html new file mode 100644 index 0000000000..83eb55baba --- /dev/null +++ b/files/zh-tw/mozilla/projects/nss/getting_started_with_nss/index.html @@ -0,0 +1,58 @@ +--- +title: Getting Started With NSS +slug: Mozilla/Projects/NSS/Getting_started_with_NSS +translation_of: Mozilla/Projects/NSS/Getting_started_with_NSS +--- +<h2 id="如何參與NSS">如何參與NSS</h2> + +<p>網絡安全服務(NSS)是Mozilla軟件使用的加密算法和安全網絡協議的基礎庫。<br> + <br> + 您想參與並幫助我們改善Mozilla Firefox和其他使用NSS的應用程序的核心安全性嗎?我們期待著您的貢獻!<br> + <br> + 我們有大量任務等待您關注,我們很樂意協助您確定與您的興趣或技能相匹配的領域。您可以在<a href="/en-US/docs/Mozilla/QA/Getting_Started_with_IRC" title="Mozilla IRC">Mozilla IRC</a>的<a href="irc://irc.mozilla.org/#nss" title="irc://irc.mozilla.org/nss">#nss</a>頻道中找到我們,也可以在<a href="https://lists.mozilla.org/listinfo/dev-tech-crypto/" title="https://lists.mozilla.org/listinfo/dev-tech-crypto/">mozilla.dev.tech.crypto</a>新聞組中提問。</p> + +<p>NSS庫及其支持的命令行工具使用C編程語言編寫。它的構建系統和自動化測試基於makefile和bash腳本。</p> + +<p>隨著時間的流逝,已經產生了許多描述NSS各個方面的文檔。您可以從以下內容開始:</p> + +<ul> + <li>當前的<a href="/en-US/docs/NSS" title="/ zh-CN / docs / NSS">主要NSS文檔頁面</a>,從中可以鏈接到其他文檔。</li> + <li>一個<a href="/en-US/docs/Overview_of_NSS" title="/ zh-CN / docs / Overview_of_NSS">總體概述</a>使用NSS和它提供的功能的應用程序。</li> + <li>高水平<a href="/en-US/docs/An_overview_of_NSS_Internals" title="/ zh-CN / docs / An_overview_of_NSS_Internals">介紹NSS的內部</a>。</li> + <li>了解有關獲取<a href="/en-US/docs/NSS_Sources_Building_Testing" title="/ en-US / docs / NSS_Sources_Building_Testing">NSS來源,構建和測試的信息。</a></li> + <li>歸檔的mozilla.org網站上的<a href="https://www-archive.mozilla.org/projects/security/pki/nss/">舊文檔</a>。</li> +</ul> + +<p>(不幸的是,NSS項目目前沒有技術撰稿人,因此我們的文檔沒有我們想要的那樣井井有條。您可以通過更好的組織方式來做出貢獻。)</p> + +<h2 id="NSS示例代碼">NSS示例代碼</h2> + +<p>由NSS開發人員維護的命令行工具是開始學習如何編寫NSS應用程序的好地方。您可以在子目錄mozilla / security / nss / cmd中找到它們</p> + +<p>或看看一些基本的<a href="/docs/Mozilla/Projects/NSS/NSS_Sample_Code">NSS示例代碼</a>。</p> + +<p>目前正在開發和審查一組新的樣本,請參閱<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=490238">創建新的NSS樣本</a>。</p> + +<p>歡迎您通過以下方式下載示例:hg clone https://hg.mozilla.org/projects/nss; cd nss; hg更新SAMPLES_BRANCH</p> + +<h2 id="如何貢獻">如何貢獻</h2> + +<p>...(此部分仍在建設中,但是有很多貢獻的機會)</p> + +<p>如果您沒有,請先在<a href="https://bugzilla.mozilla.org/">bugzilla.mozilla.org上</a>打開一個bugzilla帳戶。</p> + +<p>NSS ::庫組件可解決您要處理的問題。我們維護了一個<a href="https://bugzilla.mozilla.org/buglist.cgi?keywords=good-first-bug%2C%20&keywords_type=allwords&classification=Components&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Libraries&product=NSS">標記為“ good-first-bug”</a>的<a href="https://bugzilla.mozilla.org/buglist.cgi?keywords=good-first-bug%2C%20&keywords_type=allwords&classification=Components&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Libraries&product=NSS">NSS錯誤</a>列表<a href="https://bugzilla.mozilla.org/buglist.cgi?keywords=good-first-bug%2C%20&keywords_type=allwords&classification=Components&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Libraries&product=NSS">,您可以查看這些錯誤</a>。</p> + +<h3 id="創建補丁">創建補丁</h3> + +<p>請參閱有關<a href="/en-US/docs/NSS_Sources_Building_Testing" title="/ en-US / docs / NSS_Sources_Building_Testing">NSS來源,構建和測試的部分,</a>以開始製作補丁。當您對此感到滿意時,就需要進行代碼審查。</p> + +<h3 id="代碼審查">代碼審查</h3> + +<p><a href="https://phabricator.services.mozilla.com">http://phabricator.services.mozilla.com/</a>是我們的代碼審查工具,它使用您的Bugzilla帳戶。使用我們的<a href="https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html">Phabricator用戶說明上傳補丁進行審核</a>。</p> + +<p><a href="https://github.com/mozilla/nss-tools/blob/master/nss-code-review-checklist.yaml">Github上的清單形式列出了</a>一些在代碼審查期間將要評估的項目<a href="https://github.com/mozilla/nss-tools/blob/master/nss-code-review-checklist.yaml">。</a></p> + +<p>通過審查後,您的補丁程序可以由NSS小組的成員登陸。您可以在<a href="/en-US/docs/Mozilla/QA/Getting_Started_with_IRC" title="Mozilla IRC">Mozilla IRC</a>的<a href="irc://irc.mozilla.org/#nss" title="irc://irc.mozilla.org/nss">#nss</a>頻道中找到我們。</p> + +<p>請注意,我們不會發布未經審查和測試的代碼。代碼僅在具有測試的情況下才有效,而測試僅在它們屬於自動化的一部分時才有效。</p> diff --git a/files/zh-tw/mozilla/projects/nss/index.html b/files/zh-tw/mozilla/projects/nss/index.html new file mode 100644 index 0000000000..186df02c73 --- /dev/null +++ b/files/zh-tw/mozilla/projects/nss/index.html @@ -0,0 +1,180 @@ +--- +title: Network Security Services +slug: Mozilla/Projects/NSS +tags: + - JSS + - NSS + - NeedsMigration + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Projects/NSS +--- +<p><strong>Network Security Services</strong> (<strong>NSS</strong>) is a set of libraries designed to support cross-platform development of security-enabled client and server applications. Applications built with NSS can support SSL v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security standards.</p> + +<p>For detailed information on standards supported, see <a href="/en-US/docs/Overview_of_NSS" title="Overview_of_NSS">Overview of NSS</a>. For a list of frequently asked questions, see the <a href="/en-US/docs/NSS_FAQ" title="NSS_FAQ">FAQ</a>.</p> + +<p>NSS is available under the Mozilla Public License. For information on downloading NSS releases as tar files, see <a href="https://developer.mozilla.org/en-US/docs/NSS_Sources_Building_Testing">Download PKI Source</a>.</p> + +<p>If you're a developer and would like to contribute to NSS, you might want to read the documents <a href="/en-US/docs/An_overview_of_NSS_Internals" title="/en-US/docs/An_overview_of_NSS_Internals">highlevel overview of internal details of NSS</a> and <a href="/en-US/docs/Getting_Started_With_NSS" title="/en-US/docs/Getting_Started_With_NSS">getting started with NSS</a>.</p> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="Documentation" name="Documentation">Documentation</h2> + + <h3 id="Background_Information">Background Information</h3> + + <dl> + <dt><a href="/en-US/docs/Overview_of_NSS">Overview of NSS</a></dt> + <dd>Provides a brief summary of NSS and its capabilities.</dd> + <dt><a href="/en-US/docs/NSS_FAQ">NSS FAQ</a></dt> + <dd>Answers basic questions about NSS.</dd> + <dt><a href="/en-US/docs/Introduction_to_Public-Key_Cryptography">Introduction to Public-Key Cryptography</a></dt> + <dd>Explains the basic concepts of public-key cryptography that underlie NSS.</dd> + <dt><a href="/en-US/docs/Introduction_to_SSL">Introduction to SSL</a></dt> + <dd>Introduces the SSL protocol, including information about cryptographic ciphers supported by SSL and the steps involved in the SSL handshake.</dd> + </dl> + + <h3 id="Getting_Started">Getting Started</h3> + + <dl> + <dt><a href="/en-US/docs/NSS/NSS_Releases" title="NSS_releases">NSS Releases</a></dt> + <dd>This page contains information about the current and past releases of NSS.</dd> + <dt><a href="/en-US/docs/NSS_Sources_Building_Testing">Get the source code and Build it</a></dt> + <dd>Instructions on how to build NSS on the different supported platforms.</dd> + <dt><a href="/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial">Get Mozilla Source Code Using Mercurial</a></dt> + <dd>Information about with working with Mercurial.</dd> + <dt><a href="/en-US/docs/Mozilla/Developer_guide/Source_Code/CVS">Get Mozilla Source Code Using CVS (deprecated)</a></dt> + <dd>Old deprecated CVS documentation.</dd> + </dl> + + <h3 id="NSS_APIs">NSS APIs</h3> + + <dl> + <dt><a href="/en-US/docs/Introduction_to_Network_Security_Services">Introduction to Network Security Services</a></dt> + <dd>Provides an overview of the NSS libraries and what you need to know to use them.</dd> + <dt><a href="NSS/SSL_functions">NSS SSL Public Functions</a></dt> + <dd>Summarizes the SSL APIs exported by the NSS shared libraries.</dd> + <dt><a href="/en-US/docs/NSS_reference">NSS SSL Reference</a></dt> + <dd>API used to invoke SSL operations.</dd> + <dt><a href="NSS/NSS_API_GUIDELINES">NSS API Guidelines</a></dt> + <dd>Explains how the libraries and code are organized, and guidelines for developing code (naming conventions, error handling, thread safety, etc.)</dd> + <dt><a href="NSS/nss_tech_notes">NSS Technical Notes</a></dt> + <dd>Links to NSS technical notes, which provide latest information about new NSS features and supplementary documentation for advanced topics in programming with NSS.</dd> + </dl> + + <h3 id="Tools_testing_and_other_technical_details">Tools, testing, and other technical details</h3> + + <dl> + <dt><a href="/en-US/docs/Mozilla/Projects/NSS/Building">Build Instructions for NSS</a></dt> + <dd>Describe how to check out and build NSS releases.</dd> + </dl> + + <dl> + <dt><a href="/en-US/docs/Mozilla/Projects/NSS/NSS_Developer_Tutorial">NSS Developer Tutorial</a></dt> + <dd>How to make changes in NSS. Coding style, maintaining ABI compatibility.</dd> + </dl> + + <dl> + <dt><a href="NSS/Tools">NSS Tools</a></dt> + <dd>Tools for developing, debugging, and managing applications that use NSS.</dd> + <dt><a href="NSS/NSS_Sample_Code">Sample Code</a></dt> + <dd>Demonstrates how NSS can be used for cryptographic operations, certificate handling, SSL, etc.</dd> + <dt><a href="NSS/NSS_Third-Party_Code">Third-Party Code</a></dt> + <dd>A list of third-party code included in the NSS library.</dd> + <dt><a href="https://www-archive.mozilla.org/projects/security/pki/nss/testnss_32.html">NSS 3.2 Test Suite</a></dt> + <dd><strong>Archived version.</strong> Describes how to run the standard NSS tests.</dd> + <dt><a href="https://www-archive.mozilla.org/projects/security/pki/nss/performance_reports.html">NSS Performance Reports</a></dt> + <dd><strong>Archived version.</strong> Links to performance reports for NSS 3.2 and later releases.</dd> + <dt><a href="https://www-archive.mozilla.org/projects/security/pki/nss/nss-3.11/nss-3.11-algorithms.html">Encryption Technologies Available in NSS 3.11</a></dt> + <dd><strong>Archived version.</strong> Lists the cryptographic algorithms used by NSS 3.11.</dd> + <dt><a href="https://www-archive.mozilla.org/projects/security/pki/nss/loadable_certs.html">NSS 3.1 Loadable Root Certificates</a></dt> + <dd><strong>Archived version.</strong> Describes the scheme for loading root CA certificates.</dd> + <dt><a href="https://www-archive.mozilla.org/projects/security/pki/nss/db_formats.html">cert7.db</a></dt> + <dd><strong>Archived version.</strong> General format of the cert7.db database.</dd> + </dl> + + <h3 id="PKCS_11_information">PKCS #11 information</h3> + + <ul> + <li><a href="/en-US/docs/PKCS11" title="PKCS11">Documentation on PKCS #11 modules</a></li> + <li><a href="/en-US/docs/PKCS11_Implement">Implementing PKCS #11 for NSS</a></li> + <li><a href="/en-US/docs/PKCS11_Module_Specs" title="PKCS11_Module_Specs">The strings NSS uses to load PKCS #11 modules</a></li> + <li><a href="/en-US/docs/PKCS11_FAQ">PKCS #11 FAQ</a></li> + <li><a href="/en-US/docs/PKCS11_Jar_Install">Using the JAR Installation Manager to Install a PKCS #11 Cryptographic Module</a></li> + <li><a href="https://www-archive.mozilla.org/projects/security/pki/pkcs11/">PKCS #11 Conformance Testing - Archived version</a></li> + </ul> + + <dl> + </dl> + + <h3 id="CA_certificates_pre-loaded_into_NSS">CA certificates pre-loaded into NSS</h3> + + <ul> + <li><a href="https://www.mozilla.org/projects/security/certs/policy/">Mozilla CA certificate policy</a></li> + <li><a href="https://wiki.mozilla.org/CA/Included_Certificates">List of pre-loaded CA certificates</a> + <ul> + <li>Consumers of this list must consider the trust bit setting for each included root certificate. <a href="https://www.imperialviolet.org/2012/01/30/mozillaroots.html">More Information</a>, <a href="https://github.com/agl/extract-nss-root-certs">Extracting roots and their trust bits</a></li> + </ul> + </li> + </ul> + + <dl> + </dl> + + <h3 id="NSS_is_built_on_top_of_Netscape_Portable_Runtime_NSPR">NSS is built on top of Netscape Portable Runtime (NSPR)</h3> + + <dl> + <dt><a href="NSPR">Netscape Portable Runtime</a></dt> + <dd>NSPR project page.</dd> + <dt><a href="/en-US/docs/Mozilla/Projects/NSPR/Reference">NSPR Reference</a></dt> + <dd>NSPR API documentation.</dd> + </dl> + + <h3 id="Additional_Information">Additional Information</h3> + + <ul> + <li><a href="/en-US/docs/JavaScript_crypto" title="JavaScript_crypto">Using the window.crypto object from JavaScript</a></li> + <li><a href="/en-US/docs/HTTP_Delegation" title="HTTP_Delegation">Delegation of HTTP download for OCSP</a></li> + <li><a href="/en-US/docs/TLS_Cipher_Suite_Discovery" title="TLS_Cipher_Suite_Discovery">TLS Cipher Suite Discovery</a></li> + <li><a href="/en-US/docs/NSS_Certificate_Download_Specification" title="NSS_Certificate_Download_Specification">NSS Certificate Download Specification</a></li> + <li><a href="/en-US/docs/NSS/FIPS_Mode_-_an_explanation" title="FIPS Mode - an explanation">FIPS Mode - an explanation</a></li> + <li><a href="/en-US/docs/NSS_Key_Log_Format" title="NSS Key Log Format">Format of key log files</a></li> + <li>View <a href="/en-US/docs/tag/NSS" title="/en-US/docs/tag/NSS">all NSS-related articles on MDN</a></li> + </ul> + + <h3 id="Planning">Planning</h3> + + <p>Information on NSS planning can be found at <a class="external" href="https://wiki.mozilla.org/NSS">wiki.mozilla.org</a>, including:</p> + + <ul> + <li><a class="external" href="https://wiki.mozilla.org/FIPS_Validation">FIPS Validation</a></li> + <li><a class="external" href="https://wiki.mozilla.org/NSS:Roadmap">NSS Roadmap page</a></li> + <li><a href="https://fedoraproject.org/wiki/User:Mitr/NSS:DeveloperFriendliness" title="https://fedoraproject.org/wiki/User:Mitr/NSS:DeveloperFriendliness">NSS Improvement Project</a></li> + </ul> + </td> + <td> + <h2 class="Community" id="Community" name="Community">Community</h2> + + <ul> + <li>View Mozilla Security forums...</li> + </ul> + + <p>{{ DiscussionList("dev-security", "mozilla.dev.security") }}</p> + + <ul> + <li>View Mozilla Cryptography forums...</li> + </ul> + + <p>{{ DiscussionList("dev-tech-crypto", "mozilla.dev.tech.crypto") }}</p> + + <h2 class="Related_Topics" id="Related_Topics" name="Related_Topics">Related Topics</h2> + + <ul> + <li><a href="/en-US/docs/Security" title="Security">Security</a></li> + </ul> + </td> + </tr> + </tbody> +</table> diff --git a/files/zh-tw/mozilla/projects/rhino/index.html b/files/zh-tw/mozilla/projects/rhino/index.html new file mode 100644 index 0000000000..9167cbfaac --- /dev/null +++ b/files/zh-tw/mozilla/projects/rhino/index.html @@ -0,0 +1,27 @@ +--- +title: Rhino +slug: Mozilla/Projects/Rhino +tags: + - JavaScript + - Mozilla + - NeedsTranslation + - NeedsUpdate + - Rhino + - TopicStub +translation_of: Mozilla/Projects/Rhino +--- +<p><img alt="Image:rhino.jpg" class="internal" src="/@api/deki/files/832/=Rhino.jpg"></p> + +<p><span class="seoSummary"><strong>Rhino</strong> is an open-source implementation of <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a> written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. It is embedded in J2SE 6 as the default Java scripting engine.</span></p> + +<h4 id="Rhino_downloads" name="Rhino_downloads">Rhino downloads</h4> + +<p>How to <a class="internal" href="/en/RhinoDownload" title="en/RhinoDownload">get source and binaries</a>. </p> + +<h4 id="Rhino_documentation" name="Rhino_documentation">Rhino documentation</h4> + +<p><a href="/en/Rhino_documentation" title="en/Rhino_documentation">Information on Rhino</a> for script writers and embedders.</p> + +<h4 id="Rhino_help" name="Rhino_help">Rhino help</h4> + +<p><a href="/en/Rhino/Community" title="en/Rhino/Community">Some resources</a> if you get stuck.</p> diff --git a/files/zh-tw/mozilla/projects/rhino/license/index.html b/files/zh-tw/mozilla/projects/rhino/license/index.html new file mode 100644 index 0000000000..951430039e --- /dev/null +++ b/files/zh-tw/mozilla/projects/rhino/license/index.html @@ -0,0 +1,47 @@ +--- +title: Rhino license +slug: Mozilla/Projects/Rhino/License +translation_of: Mozilla/Projects/Rhino/License +--- +<p><font><font>Rhino可在開源許可下使用。</font></font></p> + +<h2 id="MPL.2FGPL_License" name="MPL.2FGPL_License"><font><font>MPL / GPL許可</font></font></h2> + +<p><font><font>Rhino的大部分源代碼都是在</font></font><a class="external" href="http://www.mozilla.org/MPL/"><font><font>MPL 1.1 / GPL 2.0</font></font></a><font><font>許可下提供的。</font></font></p> + +<h2 id="License_for_portions_of_the_Rhino_debugger" name="License_for_portions_of_the_Rhino_debugger"><font><font>部分Rhino調試器的許可證</font></font></h2> + +<p><font><font>此外,一些文件(目前是toolsrc / org / mozilla / javascript / tools / debugger / treetable /的內容)在以下許可下可用:</font></font></p> + +<pre><font><font> *版權所有1997,1998 Sun Microsystems,Inc。保留所有權利。</font></font><font><font> + *</font></font><font><font> + *重新分發和使用源和二進制形式,有或沒有</font></font><font><font> + *修改,如果滿足以下條件,則允許</font></font><font><font> + *符合:</font></font><font><font> + *</font></font><font><font> + * - 源代碼的重新分發必須保留上述版權</font></font><font><font> + *通知,此條件清單和以下免責聲明。</font></font><font><font> + *</font></font><font><font> + * - 二進制形式的再分發必須複製上述版權</font></font><font><font> + *通知,此條件清單和以下免責聲明</font></font><font><font> + *隨分發提供的文件和/或其他材料。</font></font><font><font> + *</font></font><font><font> + * - Sun Microsystems的名稱和名稱</font></font><font><font> + *貢獻者可用於支持或推廣衍生產品</font></font><font><font> + *未經事先書面許可,不得使用本軟件。</font></font><font><font> + *</font></font><font><font> + *本軟件由版權所有者和貢獻者“提供</font></font><font><font> + *“是”以及任何明示或暗示的擔保,包括但不限於,</font></font><font><font> + *對適銷性和特定適用性的暗示保證</font></font><font><font> + *目的不承擔任何責任。</font><font>在任何情況下都不應該是版權所有者或</font></font><font><font> + *貢獻者對任何直接,間接,偶然,特殊的,</font></font><font><font> + *示範性或後續性損害(包括但不限於,</font></font><font><font> + *購買替代商品或服務; </font><font>丟失使用,數據或</font></font><font><font> + *利潤; </font><font>或商業中斷)然而,導致和任何理論</font></font><font><font> + *責任,無論是合同,嚴格責任還是侵權(包括</font></font><font><font> + *疏忽或以其他方式)以任何方式使用此產品</font></font><font><font> + *軟件,即使被告知此類損害的可能性。</font></font> +</pre> + +<hr> +<p><a href="/User:Norrisboyd" title="用戶:Norrisboyd"><font><font>Norrisboyd</font></font></a><font><font> 2008年4月14日06:16(PDT)</font></font></p> diff --git a/files/zh-tw/mozilla/qa/bug_writing_guidelines/index.html b/files/zh-tw/mozilla/qa/bug_writing_guidelines/index.html new file mode 100644 index 0000000000..57d1cc41db --- /dev/null +++ b/files/zh-tw/mozilla/qa/bug_writing_guidelines/index.html @@ -0,0 +1,246 @@ +--- +title: Bug writing guidelines +slug: Mozilla/QA/Bug_writing_guidelines +tags: + - 錯誤回報 +translation_of: Mozilla/QA/Bug_writing_guidelines +--- +<div class="note"> +<p><strong>If you need help with Mozilla software (for example with Firefox, Seamonkey or Thunderbird), use one of the available <a href="http://www.mozilla.org/support/">support options</a>.</strong> Do not edit this page!</p> +</div> + +<p><span class="seoSummary">This page assumes you'd like to contribute to the Mozilla project by collecting enough information to enter a useful bug report in Bugzilla, the Mozilla bug tracking system.</span> Thank you!</p> + +<p>If you're new to reporting bugs, you may want to try getting help from the more experienced contributors. See the Community section on the <a href="/en-US/docs/QA">QA</a> page for pointers. If you're going to report a Firefox bug, you can also get assistance in the <span style="font-family: monospace;">#firefox</span> channel on <a href="irc://irc.mozilla.org/firefox">irc.mozilla.org</a>. For other projects (e.g., Thunderbird, SeaMonkey) you can find the appropriate channel on <a href="https://wiki.mozilla.org/IRC">IRC</a>.</p> + +<h2 id="如何回報錯誤">如何回報錯誤</h2> + +<h3 id="每次回報一個錯誤">每次回報一個錯誤</h3> + +<p>如此一來能夠有效率地處理每個錯誤。</p> + +<h3 id="其他需要您注意的事項">其他需要您注意的事項</h3> + +<ol> + <li>釐清如何 <strong>重現您遇到的錯誤</strong>: + + <ul> + <li>如果能夠 <a href="#Writing_precise_steps_to_reproduce">完整描述重現錯誤過程</a> —太棒了! — 您將提供有收穫的錯誤回報。</li> + <li>有時能夠重現問題,但不確定是用什麼特定的方法,則您需要提供有幫助的<a href="#specific-types">額外資訊。</a></li> + <li>如果無法重現問題,回報該問題可能沒有太大的幫助,除非在發現錯誤時,您有獨特的發現。</li> + </ul> + </li> + <li>檢查軟體是否已更新至最新版本。建議先測試開發中版本來確認錯誤是不是早就修正(例如:<a href="http://www.mozilla.com/en-US/firefox/channel/">Firefox Beta, Aurora</a>, 或是走在科技前端的 <a class="link-https" href="https://nightly.mozilla.org/">Nightly</a>)</li> + <li>When reporting a Firefox bug, first check if you can reproduce the bug in a <a href="https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles">new Firefox profile</a>. If the bug only happens in your existing profile, try to figure out what <a href="https://support.mozilla.org/en-US/kb/troubleshoot-extensions-themes-to-fix-problems">settings, extensions</a>, or <a href="https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data">files in your profile</a> are needed to reproduce the bug. + <ul> + <li>If the bug seems egregious (i.e. obviously affecting a large portion of users), there's probably something unusual about your setup that's a necessary part of the steps to reproduce the bug. You have much better chances of figuring it out than a developer who does not have access to your system.</li> + <li>If the bug falls into one of <a href="#specific-types">specific types of bugs listed in a section below</a>, it may still be useful even if you can't reproduce it in a new Firefox profile.</li> + </ul> + </li> + <li>Open the <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?format=guided">Enter a new bug</a> form, which will guide you through most of the bug reporting process: + <ul> + <li>Create a Bugzilla account if you don't have one already, select the product having the bug.</li> + <li>Enter a <strong>clear unique summary</strong> as <a href="#Writing_a_clear_summary">described below</a>; check if the bug has already been reported (if you want to be more thorough, there's an advanced guide on <a href="/en-US/docs/Screening_duplicate_bugs">screening duplicate bugs</a>).</li> + <li>Provide <strong>precise steps to reproduce</strong>, <strong>expected results</strong> and <strong>actual results</strong> as <a href="#Writing_precise_steps_to_reproduce">described in the following section</a>.</li> + <li>Provide additional information (also <a href="#Providing_additional_information">described below</a>), especially if you can't reproduce the bug in a new profile; and/or by reporting a <strong>crash</strong>, <strong>memory usage</strong>, <strong>performance</strong>, <strong>regression</strong> bug; or if the problem is with a specific web site.</li> + </ul> + </li> + <li>如果遇到多個錯誤時,請分開一個一個回報。</li> +</ol> + +<h2 id="簡短明確描述問題">簡短明確描述問題</h2> + +<p>您會怎麼用大概十幾個字描述問題? 開發者會先看到這一部分文字。</p> + +<p>好的錯誤回報會快速且清楚說明錯誤。這是用來解釋問題的來龍去脈,請不要給予針對問題的建議。</p> + +<ul> + <li>好: "在複製檔案時按取消會讓檔案管理員當掉"</li> + <li>不夠好: "當掉了"</li> +</ul> + +<ul> + <li>好: "Down-arrow scrolling doesn't work in <textarea> styled with overflow:hidden"</li> + <li>不夠好: "瀏覽器應該要可以正常顯示我的網站"</li> +</ul> + +<h2 id="描述可以重現問題的詳細的步驟">描述可以重現問題的詳細的步驟</h2> + +<p>How can a developer reproduce the bug on his or her own computer?</p> + +<p>Steps to reproduce are the <strong>most important part of any bug report</strong>. If a developer is able to reproduce the bug, the bug is very likely to be fixed. If the steps are unclear, it might not even be possible to know whether the bug has been fixed.</p> + +<table class="standard-table"> + <tbody> + <tr> + <th>在問題回報裡應該寫些什麼 ?</th> + <th>好的例子(描述細節)</th> + <th> + <p>不好的例子(敘述籠統)</p> + </th> + </tr> + <tr> + <td> + <p>說說你能不能控制卡 bug 的時機。</p> + + <p>可以故意卡、偶爾遇到、不能控制。</p> + </td> + <td>照著下面的步驟做問題就出現了:</td> + <td> </td> + </tr> + <tr> + <td> + <p>描述如何命令 Firefox 做你想做的事。</p> + </td> + <td> + <p>1. 點桌面捷徑打開 Firefox<br> + 2. 按下 Cmd+N (Windows 系統按 Ctrl+N )來打開新的視窗。</p> + + <p>3. 把 <a class="link-https" href="https://mail.google.com/" rel="freelink">https://mail.google.com/</a> 複製貼上到網址列然後按Enter。</p> + </td> + <td>在新視窗打開Gmail</td> + </tr> + <tr> + <td> + <p>照著步驟做後,清楚地描述<strong>你看到的 (實際) 結果</strong> 和 <strong>預期結果。</strong> 請將這兩項分開來寫。</p> + </td> + <td><strong>預期結果</strong>: 我的收件匣正常顯示。<br> + <strong>實際結果</strong>: 我的收件匣顯示 '您的瀏覽器不支援 Cookies (錯誤 -91)'。</td> + <td> + <p> </p> + + <p>"網頁跑不出來"</p> + </td> + </tr> + </tbody> +</table> + +<h2 id="提供額外的資訊">提供額外的資訊</h2> + +<p>The following information is requested for most bug reports. You can save time by providing this information below the Expected results. If you need to attach multiple files, you can do so after submitting the report.</p> + +<h3 id="For_specific_types_of_bugs"><a name="specific-types">For specific types of bugs</a></h3> + +<p>If you are reporting a <strong>crash bug</strong>, please <a href="/en-US/docs/How_to_get_a_stacktrace_for_a_bug_report">include a Breakpad ID or attach stack trace</a>, and include the crash signature in the bug summary as well as in the <strong>Crash Signature</strong> field.</p> + +<p>If you are reporting a <strong>memory use or leak bug</strong>, please <a href="/en-US/docs/Mozilla/Performance/about:memory">attach the output of about:memory</a>. Ideally, find steps to reproduce an increase in what is shown in about:memory (even after clicking the "Minimize memory usage" button at the bottom). If you have trouble finding steps to reproduce, try the Firefox Support page titled <a href="https://support.mozilla.org/en-US/kb/firefox-uses-too-much-memory-ram">Firefox Uses Too Much Memory (Ram) - How to Fix</a>. If you are a C++ developer, <a class="link-https" href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance">more precise tools are available</a>.</p> + +<p>If you are reporting a <strong>bug about slowness or high CPU usage</strong>, please <a href="/en-US/docs/Mozilla/Performance/Reporting_a_Performance_Problem">provide a link to the performance profile in the bug</a>.</p> + +<p>If you are reporting a <strong>hang</strong> (beachball on OS X or "not responding" on Windows), please follow the instructions in <a href="/en-US/docs/How_to_Report_a_Hung_Firefox">How to Report a Hung Firefox</a>.</p> + +<p>If you are reporting a bug involving a <strong>Flash hang</strong>, please visit <a href="https://wiki.mozilla.org/Flash/Hang_Debugging">https://wiki.mozilla.org/Flash/Hang_Debugging</a> to learn how to provide useful information for developers.</p> + +<p>If you are reporting a <strong>bug involving a specific web page</strong>, please try to make a <a href="/en-US/docs/Reducing_testcases">reduced testcase</a> and attach it to the bug report. If you don't have time or expertise, please report the issue to <a href="https://webcompat.com/">webcompat.com</a> instead, where our volunteers will do this for you.</p> + +<p>If the bug was <strong>recently introduced</strong>, finding a <a href="http://mozilla.github.io/mozregression/quickstart.html">regression window</a> can help identify the cause of the bug.</p> + +<p><a href="http://www.chiark.greenend.org.uk/~sgtatham/bugs.html#intermittent">What if my bug seems "random" or "intermittent"?</a></p> + +<h3 id="For_most_Firefox_bugs">For most Firefox bugs</h3> + +<p>You should provide the following information for most Firefox bugs.</p> + +<table class="standard-table"> + <tbody> + <tr> + <th>What should you include in a bug report?</th> + <th>Example</th> + </tr> + <tr> + <td>Indicate if the problem can be reproduced using a <a href="https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles">new Firefox profile</a> and any changes you need to make in order to reproduce.</td> + <td>The problem can be reproduced in a new profile, but only if Preferences -> Privacy & Security -> Tracking Protection is selected.</td> + </tr> + <tr> + <td>If you can only reproduce with an existing profile try to figure out what <a href="https://support.mozilla.org/en-US/kb/troubleshoot-extensions-themes-to-fix-problems">settings, extensions</a>, or <a href="https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data">files in your profile</a> are needed to reproduce the bug. If you skip the step, <a href="https://support.mozilla.org/en-US/kb/use-troubleshooting-information-page-fix-firefox">save the troubleshooting information from about:support</a> to a file and attach it to the bug report.</td> + <td>I can't reproduce in a new profile, about:support information from the offending profile is attached.</td> + </tr> + <tr> + <td> + <p>Indicate if the problem can be reproduced using the <a href="https://nightly.mozilla.org/">latest Nightly build</a>. Include the <strong>Build ID</strong> from <a href="https://support.mozilla.org/en-US/kb/use-troubleshooting-information-page-fix-firefox">about:support</a>.</p> + + <p>If possible, test using the new Firefox profile you created. If you need to test the Nightly build with your regular profile, you might want to <a href="https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles">back up the profile</a> first, since the pre-release build may corrupt your data.</p> + </td> + <td>The problem can be reproduced on the latest Nightly (Build ID 20170416100136).</td> + </tr> + </tbody> +</table> + +<p> </p> + +<div class="originaldocinfo"> +<h2 id="Original_document_information">Original document information</h2> + +<ul> + <li>Author(s): Jesse Ruderman, Gervase Markham</li> + <li>Other Contributors: Eli Goldberg, Claudius Gayle, Jan Leger, Felix Miata, Peter Mock, Chris Pratt, Chris Yeh, and others.</li> +</ul> +</div> + +<p> </p> + +<hr> +<h2 id="Advanced">Advanced</h2> + +<h3 id="Finding_the_correct_product_and_component" name="Finding_the_correct_product_and_component"><strong style="font-weight: bold;">Finding the correct product and component</strong></h3> + +<p>You will be asked to categorize your bug into a "product" and a "component" within that product, in order to direct your report to the correct developers.</p> + +<p>If you're using Firefox, the bug is most likely in "Firefox", "Toolkit", or "Core".</p> + +<ul> + <li><a class="link-https" href="https://bugzilla.mozilla.org/describecomponents.cgi?product=Firefox">List of components in the "Firefox" product</a> - Most parts of Firefox that you interact with directly</li> + <li><a class="link-https" href="https://bugzilla.mozilla.org/describecomponents.cgi?product=Toolkit">List of components in the "Toolkit" product</a> - Interface widgets and some frontend features</li> + <li><a class="link-https" href="https://bugzilla.mozilla.org/describecomponents.cgi?product=Core">List of components in the "Core" product</a> - Web page rendering, networking, etc.</li> +</ul> + +<p>When in doubt, search for similar bugs and see which component they are in.</p> + +<p>If none of the components seem appropriate, look for a "General" component in the most appropriate product.</p> + +<h3 id="General_Outline_of_a_Bug_Report">General Outline of a Bug Report</h3> + +<div class="note"> +<p>Most of the following article has been merged into this page from QMO: How to write a proper bug</p> +</div> + +<ul> + <li><strong>Summary</strong>: How would you describe the bug in less than 60 characters? It should quickly and uniquely identify a bug report as well as explain the problem, not your suggested solution. Good: "Canceling a File Copy dialog crashes File Manager" Bad: "Software crashes" Bad: "Browser should work with my web site"</li> + <li><strong>Component</strong>: In which sub-part of the software does it exist? This field is a requirement to submit any bug report. Click the word "Component" to see a description of each component. If none seems appropriate, highlight the "General" component.</li> + <li><a name="version"> </a><strong>Version</strong>: select the earliest Version with what the problem can be reproduced: + <ul> + <li>Developers will use that information to narrow down the commit what introduced a regression</li> + <li>QA staff needs that information to distinguish bugs with similar symptoms, but different roots. + <ul> + <li>Bugs that definitively appeared in different <em>Product</em> <em>Versions</em> probably will have different roots</li> + <li>But Bugs that started with the same <em>Product</em> <em>Version</em> probably are DUPLICATEs</li> + </ul> + </li> + <li><em>Trunk</em> does not allow any useful query. We have <em>Trunk</em> version bugs from beginning of the project until today, no common characteristics at all what can be tagged with this version. Avoid Trunk, replace it by precise information with what version the problem appeared if you can.</li> + </ul> + </li> + <li><strong>OS</strong>: On which operating system (OS) did you find it? (E.g. Linux, Windows, and Mac.) Example: "<em>If you know the bug happens on more than one type of operating system, choose "All". If your OS isn't listed, choose Other".</em></li> + <li><strong>Description</strong>: The details of your problem report, including: + <ul> + <li><u>Overview</u>: This is a larger detailed restatement of the summary. An example would be: <em>"Drag-selecting any page crashes Mac builds in the NSGetFactory function"</em>.</li> + <li><u>Build Id</u>: To find this either go to the "about:support" page via the location bar or, if you have MozQA's <a href="https://addons.mozilla.org/en-US/firefox/addon/nightly-tester-tools/">Nightly Tester Tools</a> extension, then go to Tools | Nightly Tester Tools and select the option that contains the output of the build Id. It should look something like this: <em>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 ID:20150330004006 CSet: 9e57e9776571"</em>.</li> + <li><u>Additional Builds and Platforms</u>: Whether or not the bug takes place on other platforms (or browsers, if applicable). It should look something like this: <em>"Doesn't Occur On Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 ID:20150330004006 CSet: 9e57e9776571"</em>.</li> + </ul> + </li> + <li><strong>Steps to Reproduce</strong>: Minimized, easy-to-follow steps that will trigger the bug. If they're necessary, make sure to include any special setup steps. A good example of this would look like the following:<br> + 1) View any web page. (I used the default sample page, http://www.google.com/).<br> + 2) Drag-select the page. Specifically, while holding down the mouse button, drag the mouse pointer downwards from any point in the browser's content region to the bottom of the browser's content region.</li> + <li><strong>Actual Results</strong>: What the application did after performing the above steps. An example would be: <em>The application crashed.</em></li> + <li><strong>Expected Results</strong>: What the application should have done, were the bug not present. An example would be: <em>The window should scroll downwards. Scrolled content should be selected. Or, at least, the application should not crash.</em></li> +</ul> + +<p> </p> + +<div class="originaldocinfo"> +<h4 id="Original_document_information_2">Original document information</h4> + +<ul> + <li>Author(s): Aakash Desai</li> + <li>Date last modified: June 3, 2013 at 2:41 am PST</li> +</ul> +</div> diff --git a/files/zh-tw/mozilla/qa/index.html b/files/zh-tw/mozilla/qa/index.html new file mode 100644 index 0000000000..99a8a38dd2 --- /dev/null +++ b/files/zh-tw/mozilla/qa/index.html @@ -0,0 +1,251 @@ +--- +title: 'QA: Quality assurance at Mozilla' +slug: Mozilla/QA +tags: + - Landing + - NeedsTranslation + - QA + - Testing + - TopicStub +translation_of: Mozilla/QA +--- +<p>The Mozilla Quality Assurance (QA) team drives software quality assurance activities across Mozilla and plays a key role in releasing a diverse range of software products on schedule. Within each project in Mozilla, we work to explore new features, write and execute tests, uncover and file bugs, build and maintain tools, collect and analyze metrics, and support the release world-class products that promote the open Web.</p> + +<p><span class="seoSummary">Here you'll find articles and tools to help you gear up to join the QA team testing Firefox to ensure that each release is as good as it can be.</span></p> + +<h2 id="Get_started">Get started</h2> + +<ul class="card-grid"> + <li><span>How can I help test?</span> + + <p>There are lots of ways for you to become a <a href="/en-US/docs/Mozilla/QA/How_can_I_help_test_">community contributor</a> to the Mozilla quality team.</p> + </li> + <li><span>Bugs</span> + <p>All Mozilla projects use <a href="https://bugzilla.mozilla.org/">Bugzilla</a> to track bugs. Learn how to <a href="/en-US/docs/Mozilla/QA/Bug_writing_guidelines" title="/en-US/docs/Mozilla/QA/Bug_writing_guidelines">report a bug</a> and get familiar with <a href="/en-US/docs/What_to_do_and_what_not_to_do_in_Bugzilla">what to do in Bugzilla</a>.</p> + </li> + <li><span>Events</span> + <p>Get involved in our weekly <a href="/en-US/docs/Mozilla/QA/Bug_Verification_Day">Bug Verification Day</a> or <a href="/en-US/docs/Mozilla/QA/Bug_Triage_Day">Bug Triage Day</a>. You may even <a href="/en-US/docs/Mozilla/QA/Organizing_a_Testday">organize a testday</a> for your local community!</p> + </li> + <li><span>IRC</span> + <p><a href="/en-US/docs/Mozilla/QA/Getting_Started_with_IRC">Get started with IRC</a>, the primary form of communication for members of the Mozilla community.</p> + </li> +</ul> + +<h2 id="Bugs">Bugs</h2> + +<div class="row topicpage-table"> +<div class="section"> +<h3 id="Reporting_bugs">Reporting bugs</h3> + +<dl> + <dt><a href="/en-US/docs/Mozilla/Bugzilla">Bugzilla</a></dt> + <dd>All Mozilla projects use <a href="https://bugzilla.mozilla.org/">Bugzilla</a> to track bugs. You will need to <a href="https://bugzilla.mozilla.org/createaccount.cgi">create an account with Bugzilla</a> in order to report bugs and triage them.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Bug_writing_guidelines" title="/en-US/docs/Mozilla/QA/Bug_writing_guidelines">Bug writing guidelines</a></dt> + <dd>The more effectively a bug is reported, the more likely that an engineer will actually fix it. By following these guidelines, you can help ensure that your bugs stay at the top of the Mozilla engineers' heap, and get fixed.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/A_Bugs_Life" title="/en-US/docs/Mozilla/QA/A_Bugs_Life">A Bug's Life</a></dt> + <dd>This tutorial will give an overview of what happens in the states that a bug will go through as well as how it will go from one to the next within its total life. It also explains the meaning of flags/keywords used in QA.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Filing_Crash_Bugs">Filing Crash Bugs</a></dt> + <dd>This document lists guidelines and tips on how to file bug reports for crashes in a way that helps in debugging and fixing the reported issue.</dd> +</dl> +</div> + +<div class="section"> +<h3 id="Triaging_bugs">Triaging bugs</h3> + +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Confirming_unconfirmed_bugs" title="en-US/docs/Confirming unconfirmed bugs">Confirming unconfirmed bugs</a></dt> + <dd>Identify useful bug reports and close the rest.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Triaging_Bugs_for_Firefox" title="/en-US/docs/Mozilla/QA/Triaging_Bugs_for_Firefox">Triaging Bugs for Firefox</a></dt> + <dd>Information about the entire bug triaging process – from processing incoming bugs to narrowing down the steps to reproducing bugs.</dd> + <dt><a href="/en-US/docs/Screening_duplicate_bugs">Screening duplicate bugs</a></dt> + <dd>Help get bugs fixed faster by screening incoming reports for duplicates.</dd> + <dt><a href="/en-US/docs/What_to_do_and_what_not_to_do_in_Bugzilla">General Guidelines</a></dt> + <dd>What to do and what not to do in Bugzilla.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Manual_testing">Manual testing</h2> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Test_Case_Writing_Primer">Manual Test Case Writing Primer</a></dt> + <dd>How to write proper manual test cases</dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a href="https://testrail.stage.mozaws.net/">TestRail</a></dt> + <dd>Mozilla QA's manual test cases reside in TestRail. You will need an LDAP account in order to login and execute test cases. Learn more on the <a href="https://wiki.mozilla.org/TestEngineering/Testrail">TestRail wiki page</a>.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Automated_testing">Automated testing</h2> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Automated_testing" title="/en-US/docs/Mozilla/QA/Automated_testing">Automated testing at Mozilla</a></dt> + <dd>Documentation about creating and using automated tests for Mozilla code.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Running_automated_tests">Running automated tests</a></dt> + <dd> + <p>This page lists the steps required to run Mozilla's automated test suites.</p> + </dd> + <dt><a href="/en-US/docs/Mozilla/QA/Developing_tests" title="en-US/docs/Developing_Tests">Developing tests</a></dt> + <dd>Ensure that future changes to Mozilla don't break things that currently work correctly.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Avoiding_intermittent_oranges" title="en-US/docs/QA/Avoiding intermittent oranges">Avoiding intermittent test failures</a></dt> + <dd>Suggestions for ways to make your tests more reliable, thereby helping to avoid random, intermittent test failures.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Test_Verification">Test Verification</a></dt> + <dd>When a changeset adds a new test, or modifies an existing test, the test verification (TV) test suite performs additional testing to help find intermittent failures in the modified test as quickly as possible.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Mozharness_FAQ">Mozharness FAQ</a></dt> + <dd>Answers to common questions about Mozharness.</dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Robocop" title="/en-US/docs/Mozilla/QA/Robocop">Robocop</a></dt> + <dd>Robocop is the automated testing system used for Firefox for Android. Learn its <a href="/en-US/docs/Mozilla/QA/Robocop/Code_style_guidelines">code style guidelines</a></dd> + <dt><a href="/en-US/docs/Mozilla/QA/Marionette">Marionette</a></dt> + <dd>Get started with Marionette UI testing.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/web-platform-tests">web-platform-tests</a></dt> + <dd>Learn how to use the industry standard, cross-browser, cross-platform <a href="http://testthewebforward.org/docs/">Web runtime testing system</a> from the <a href="https://www.w3.org/">W3C</a> used by Mozilla and others to ensure browser interoperability.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/external-media-tests">External Media Tests</a></dt> + <dd>Get started testing HTML5-based video elements using VideoPuppeteer, a <a href="/en-US/docs/Mozilla/QA/Marionette">Marionette</a>- -based test suite used to test sites like YouTube and Netflix.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Chrome_tests">Chrome tests</a></dt> + <dd>A chrome test is basically a <a href="https://developer.mozilla.org/en-US/docs/Mochitest" title="en/Mochitest">Mochitest</a> running with chrome privileges.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Firefox_QE">Firefox QE</h2> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Triaging_Bugs_for_Firefox" title="/en-US/docs/Mozilla/QA/Triaging_Bugs_for_Firefox">Triaging Bugs for Firefox</a></dt> + <dd>Information about the entire bug triaging process – from processing incoming bugs to narrowing down the steps to reproduce a bug.</dd> +</dl> + +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Tips_and_Tricks">Tips and Tricks</a></dt> + <dd>These tips and tricks will make your life easier when you are testing.</dd> +</dl> +<a href="/en-US/docs/Downloading_Nightly_or_Trunk_Builds">Downloading Nightly or Trunk Builds</a> + +<dl> + <dd>Every 24 hours, a "nightly" build is created that testers all over the world download and test, reporting as they go along on any bugs that hit them. </dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/Command_Line_Options">Command Line Options</a></dt> + <dd>Command line options are used to specify various startup options for Firefox.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Reporting_a_Performance_Problem">Reporting a Performance Problem</a></dt> + <dd>This article will guide you in reporting a performance problem using the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler">Gecko Profiler extension</a>.</dd> + <dt><a href="/en-US/docs/Mozilla/Projects/Crash_reporting">Crash reporting</a></dt> + <dd>Firefox ships with an open-source crash reporting system.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Firefox_for_Android">Firefox for Android</h2> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Mobile_Firefox">Mobile Firefox</a></dt> + <dd>Firefox for Android is the mobile version of Firefox with a native Android look and feel.</dd> + <dt><a href="/en-US/Firefox_for_Android/Compatibility_Testing">Compatibility Testing</a></dt> + <dd>Help us identify websites that do not work well in Firefox by reporting the specific issues that you find in your investigation.</dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Fennec_Android:_Logging_with_the_Android_Debug_and_Logcat">Logging with the Android Debug Bridge and Logcat</a></dt> + <dd>This article will provide a walkthrough in downloading and setting up an environment to which one can gain access to and view Android system logs.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Firefox_Mobile:_Enabling_the_Error_Console">Enabling the Error Console</a></dt> + <dd>See the Mozilla Hacks article on <a class="external external-icon" href="https://hacks.mozilla.org/2012/08/remote-debugging-on-firefox-for-android/">Remote Debugging on Firefox for Android</a> for web content. If you need to debug the Firefox browser itself use Android's <a class="external external-icon" href="http://developer.android.com/tools/help/logcat.html">adb logcat</a>.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Firefox_OS">Firefox OS</h2> + +<div class="row topicpage-table"> +<div class="section"> +<h3 id="Manual_testing_2">Manual testing</h3> + +<dl> + <dt><a href="/en-US/Firefox_OS/Simulator_vs_Emulator_vs_Device">Simulator vs Emulator vs Device</a></dt> + <dd>These are three basic options when it comes to getting a Firefox OS environment in order to work on, or developing for, Firefox OS.</dd> + <dt><a href="/en-US/Firefox_OS/Debugging">Debugging</a></dt> + <dd>Discover the different tools at your disposal to debug your Firefox OS code.</dd> + <dt><a href="/en-US/Firefox_OS/Developing_Firefox_OS/Filing_bugs_against_Firefox_OS">Reporting Bugs</a></dt> + <dd>This article provides a guide to filing bugs against the Firefox OS project, including Gaia and B2G.</dd> +</dl> +</div> + +<div class="section"> +<h3 id="Platform_(Gecko)">Platform (Gecko)</h3> + +<dl> + <dt><a href="/en-US/Firefox_OS/Platform/Automated_testing">Automated Testing</a></dt> + <dd>Learn various aspects of testing Firefox OS, including running different tests, automation, and result reporting and tracking.</dd> + <dt><a href="/en-US/Firefox_OS/Platform/Automated_testing/Gaia_performance_tests">Gaia Performance Tests</a></dt> + <dd>This article provides information about running performance tests on Gaia, as well as how to create new tests.</dd> + <dt><a href="/en-US/Firefox_OS/Platform/Feature_support_chart">Feature Support Chart</a></dt> + <dd>There are several different builds of Firefox OS you can download or build for yourself, and there are some differences between the types of features available on each device.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Web_QA">Web QA</h2> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Reducing_testcases" title="en-US/docs/Reducing testcases">Reducing testcases</a></dt> + <dd>Improve bug reports by turning broken web pages into simple testcases, which can help developers understand the bug and can also be used for creating automated tests.</dd> + <dt><a href="/en-US/docs/Mozilla/QA/Managing_Web_QA_XFails">Managing XFails</a></dt> + <dd>One of the ongoing tasks of the Web QA department is managing xfails. This document will explain what xfails are, and describe the steps one can take to investigate and update them.</dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Mozilla/QA/Running_Web_QA_automated_tests">Running Automated Tests</a></dt> + <dd>So you’re interested in contributing to Mozilla Web QA automation projects but don’t know where to start? This doc will help you get up and running a set of tests locally.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Glossary">Glossary</h2> + +<div class="section"> +<dl> + <dt><a href="/en-US/docs/Glossary/Smoke_Test">Smoke Test</a></dt> + <dd></dd> +</dl> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="https://lists.mozilla.org/listinfo/dev-quality">Mailing list</a></li> + <li><a href="https://quality.mozilla.org/">Blog</a></li> + <li><a href="/en-US/docs/tag/QA" title="en-US/docs/tag/QA">View all documents tagged QA</a></li> + <li><a href="/en-US/docs/tag/QA:Tools" title="en-US/docs/tag/QA:Tools">View all documents tagged QA:Tools</a></li> +</ul> diff --git a/files/zh-tw/mozilla/rust/index.html b/files/zh-tw/mozilla/rust/index.html new file mode 100644 index 0000000000..28f46deb33 --- /dev/null +++ b/files/zh-tw/mozilla/rust/index.html @@ -0,0 +1,40 @@ +--- +title: Rust 程式語言 +slug: Mozilla/Rust +translation_of: Mozilla/Rust +--- +<p><img alt="Rust logo" src="https://www.rust-lang.org/logos/rust-logo-blk.svg" style="float: left; height: 150px; width: 150;"><a href="https://www.rust-lang.org/">Rust</a> 是個由 Mozilla 及社區志願者所建立的開源系統程式語言,旨在幫助開發者建立快速安全,並充分使用當代多核心處理器強大功能的程式。它會阻止記憶體區段錯誤(segmentation fault)並確保執行緒(thread)安全、並使用簡單明瞭的語法。</p> + +<p>另外,Rust 提供了 zero-cost abstractions, move semantics, guaranteed memory safety, threads with no data races, trait-based generics, pattern matching, type inference, and efficient C bindings, with a minimum runtime size.</p> + +<p>要學習 Rust,可以透過:</p> + +<ul> + <li>觀看下面的影片,仔細觀察 Rust 提供的功能與優勢。</li> + <li>閱讀網路上的電子書 <em><a href="https://doc.rust-lang.org/book/">The Rust Programming Language</a></em>。</li> + <li>下載 Rust 編譯器、看看範例、學習你可以、希望在 <a href="https://www.rust-lang.org/">Rust 官方網站</a> 學到的一切。</li> +</ul> + +<h2 id="Rust_and_the_future_of_systems_programming">Rust and the future of systems programming</h2> + +<p>{{EmbedYouTube("8EPsnf_ZYU0")}}</p> + +<h2 id="Unlocking_the_power_of_parallelism_with_Rust">Unlocking the power of parallelism with Rust</h2> + +<p>{{EmbedYouTube("cNeIOt8ZdAY")}}</p> + +<h2 id="Rust_for_web_developers">Rust for web developers</h2> + +<p>{{EmbedYouTube("FfoXFnzZbBM")}}</p> + +<h2 id="Safe_systems_programming_with_Rust">Safe systems programming with Rust</h2> + +<p>{{EmbedYouTube("P3sfNGtpuxc")}}</p> + +<h2 id="Growing_the_Rust_community">Growing the Rust community</h2> + +<p>{{EmbedYouTube("duv0tuPAnO0")}}</p> + +<h2 id="Putting_Rust_into_production_at_Mozilla">Putting Rust into production at Mozilla</h2> + +<p>{{EmbedYouTube("2RhbYpgVpg0")}}</p> diff --git a/files/zh-tw/mozilla/tech/index.html b/files/zh-tw/mozilla/tech/index.html new file mode 100644 index 0000000000..f9682e62e1 --- /dev/null +++ b/files/zh-tw/mozilla/tech/index.html @@ -0,0 +1,14 @@ +--- +title: Mozilla technologies +slug: Mozilla/Tech +tags: + - Landing + - Mozilla + - NeedsTranslation + - Reference + - TopicStub + - XUL +translation_of: Mozilla/Tech +--- +<p>Mozilla has several technologies used as components of its projects. These are documented here. (flesh out this text).</p> +<p>{{LandingPageListSubpages}}</p> diff --git a/files/zh-tw/mozilla/tech/xpcom/reference/index.html b/files/zh-tw/mozilla/tech/xpcom/reference/index.html new file mode 100644 index 0000000000..29d07953d6 --- /dev/null +++ b/files/zh-tw/mozilla/tech/xpcom/reference/index.html @@ -0,0 +1,27 @@ +--- +title: XPCOM reference +slug: Mozilla/Tech/XPCOM/Reference +tags: + - Add-ons + - Extensions + - Landing + - Mozilla + - NeedsTranslation + - Reference + - TopicStub + - XPCOM +translation_of: Mozilla/Tech/XPCOM/Reference +--- +<p>This reference describes the interfaces and functions provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM">XPCOM</a> library. In addition, it details the various helper classes and functions, as well as the components, provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a> library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.</p> + +<div class="warning"> +<p><strong>WebExtensions are becoming the new standard for creating add-ons. </strong>Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions">WebExtensions</a> API, and <a href="https://mzl.la/webext-feature-needed">report any missing functionality</a> so we can be sure to address your concerns. Work is ongoing on WebExtension capabilities, so your input will help prioritize and plan the work. To learn more about the kinds of changes that will be needed, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a>. In addition, any binaries you use will then need to be converted for use with the WebExtensions <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging">native messaging</a> API, or compiled using <a href="https://webassembly.github.io/">WebAssembly</a> or <a href="/en-US/docs/Mozilla/Projects/Emscripten">Emscripten</a>.</p> +</div> + +<div class="note"> +<p>If you're working on a module in the Mozilla codebase that's compiled with the <code>MOZILLA_INTERNAL_API</code> flag set, some of these APIs -- the string functions and classes in particular -- are not the ones you should be using. See the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Guide/Internal_strings">XPCOM internal string guide</a> for documentation of the internal string API used within the Mozilla codebase.</p> +</div> + +<p>{{LandingPageListSubpages}}</p> + +<p>Many XPCOM pages return an <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Core_functions/nsresult">nsresult</a></code>. Prior to Gecko 19 {{geckoRelease(19)}}, this was an integer that simply returned an error code. It is now a strongly typed <code>enum</code> when XPCOM is built using a C++11 compiler. This causes compile-time errors to occur when improper values are returned as nsresult values, thereby making it easier to catch many bugs.</p> diff --git a/files/zh-tw/mozilla/tech/xpcom/reference/interface/index.html b/files/zh-tw/mozilla/tech/xpcom/reference/interface/index.html new file mode 100644 index 0000000000..d098cf8402 --- /dev/null +++ b/files/zh-tw/mozilla/tech/xpcom/reference/interface/index.html @@ -0,0 +1,19 @@ +--- +title: XPCOM Interface Reference +slug: Mozilla/Tech/XPCOM/Reference/Interface +tags: + - NeedsTranslation + - TopicStub + - XPCOM + - XPCOM Interface Reference +translation_of: Mozilla/Tech/XPCOM/Reference/Interface +--- +<p><span class="seoSummary">This is a reference to the XPCOM interfaces provided by the Mozilla platform.</span></p> + +<div class="cols-3">{{tree('','1')}}</div> + +<h2 id="See_also" name="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/XPCOM_Interface_Reference_group" title="XPCOM_Interface_Reference_group">Interfaces grouped by function</a></li> +</ul> diff --git a/files/zh-tw/mozilla/tech/xpcom/reference/interface/nsicontentpolicy/index.html b/files/zh-tw/mozilla/tech/xpcom/reference/interface/nsicontentpolicy/index.html new file mode 100644 index 0000000000..6ed47b6c80 --- /dev/null +++ b/files/zh-tw/mozilla/tech/xpcom/reference/interface/nsicontentpolicy/index.html @@ -0,0 +1,491 @@ +--- +title: nsIContentPolicy +slug: Mozilla/Tech/XPCOM/Reference/Interface/nsIContentPolicy +translation_of: Archive/Mozilla/nsIContentPolicy +--- +<p><font><font>{{IFSummaryStart(“DOM /鹼/ nsIContentPolicy.idl”,“編寫腳本”)}}接口用於實現內容策略的機制。</font><font>這個接口的實現可以被用來控制各種類型的外的線的內容,或者某些類型的內聯內容的處理的負荷。{{IFSummaryEnd(“nsIContentPolicyBase”,42,“1.0”)}}</font></font></p> + +<p><font><font>可以觀察到,正在通過實施{{接口(“nsIContentPolicy”)}}加載到瀏覽器中的內容。</font><font>如果你正在開發一個內容感知的插件(攔截廣告或改變內容的外觀,例如)該接口是非常有用的,或者如果你想停止或允許用戶瀏覽的網址。</font></font></p> + +<p><font><font>{{WarningStart()}}不要阻塞調用者在你的實施方式{{manch(“shouldLoad”)}}或{{manch(“為ShouldProcess”)}}(例如,通過啟動一個對話框,以提示用戶東西)。“){{WarningEnd()}}</font></font></p> + +<div class="note"> +<p><strong><font><font>注:</font></font></strong><font><font>在現實中,很多這種接口在{{接口(“nsIContentPolicyBase”)}}接口定義,但現在,直到有人有時間來拆東西記錄在這裡。</font></font></p> +</div> + +<h2 id="Method_overview" name="Method_overview"><font><font><font><font>方法概述</font></font></font></font></h2> + +<table class="standard-table"> + <tbody> + <tr> + <td><code>short <a href="#shouldLoad()">shouldLoad</a>(in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra, in nsIPrincipal aRequestPrincipal);</code></td> + </tr> + <tr> + <td><code>short <a href="#shouldProcess()">shouldProcess</a>(in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeType, in nsISupports aExtra, in nsIPrincipal aRequestPrincipal);</code></td> + </tr> + </tbody> +</table> + +<h2 id="Constants" name="Constants"><font><font><font><font>常量</font></font></font></font></h2> + +<h3 id="內容類型"><font><font>內容類型</font></font></h3> + +<table class="standard-table"> + <tbody> + <tr> + <td class="header"><font><font>不變</font></font></td> + <td class="header"><font><font><font><font>值</font></font></font></font></td> + <td class="header"><font><font><font><font>描述</font></font></font></font></td> + </tr> + <tr> + <td><code>TYPE_OTHER</code></td> + <td><code>1</code></td> + <td><font><font>指示內容,其類型是未知的,或者是不感興趣的一個有限的使用情況之外。</font><font>在一般情況下,你應該盡量不要使用這種類型的,除非沒有其他人是合適的。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_SCRIPT</code></td> + <td><code>2</code></td> + <td><font><font>表示的可執行</font></font><code>script</code><font><font>(例如JavaScript)。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_IMAGE</code></td> + <td><code>3</code></td> + <td><font><font><font><font>指示</font></font></font></font><code>image</code><font><font><font><font>(例如,{{HTMLElement的(“IMG”)}}的元素)。</font></font></font><font><font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>TYPE_STYLESHEET</code></td> + <td><code>4</code></td> + <td><font><font>指示</font></font><code>stylesheet</code><font><font>(例如,{{HTMLElement的(“風格”)}}的元素)。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_OBJECT</code></td> + <td><code>5</code></td> + <td><font><font>代表一個普通</font></font><code>object</code><font><font>(插件,處理內容通常這一類下降)。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_DOCUMENT</code></td> + <td><code>6</code></td> + <td><font><font>表示DOM {{domxref(“文件”)}}在頂層(即,直接在瀏覽器標籤)。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_SUBDOCUMENT</code></td> + <td><code>7</code></td> + <td> + <p><font><font>表示包含在另一個一{{domxref(“文件”)}} </font></font><code>document</code><font><font>(</font><font>例如,{{HTMLElement的(“IFRAME”)}}和{{HTMLElement的(“幀”)}}的元素)。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></p> + + <div class="note"> + <p><strong><font><font>注:</font></font></strong><font><font>壁虎使用</font></font><code>TYPE_INTERNAL_FRAME</code><font><font>,並</font></font><code>TYPE_INTERNAL_IFRAME</code><font><font>以內部辨別其差異。</font><font>這些類型映射到</font></font><code>TYPE_SUBDOCUMENT</code><font><font>被傳遞到內容政策實施前,不應外壁虎代碼中使用。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_REFRESH</code></td> + <td><code>8</code></td> + <td> + <p><font><font>指示定時刷新。</font></font></p> + + <p><font><font>{{manch(“shouldLoad”)}}將永遠不會得到這個,因為它並不代表內容被加載(通過刷新觸發的實際負載將通過{{manch(“shouldLoad”)}}如預期)。</font></font></p> + <font><font>{{manch(“為ShouldProcess”)}}將收到此為,例如{{HTMLElement的(“元”)}}刷新元件和HTTP刷新頭。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_XBL</code></td> + <td><code>9</code></td> + <td><font><font>指示XBL綁定請求,觸發或者通過{{cssxref(“ - MOZ結合”)}} CSS屬性或{{domxref(“Document.addBinding()”)}}方法。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_PING</code></td> + <td><code>10</code></td> + <td><font><font>表示通過在{{HTML元素(“A”)}}使用元素{{htmlattrxref(“平”,“一”)}}屬性的點擊觸發的平。</font><font>{{gecko_minversion_inline(“1.9”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_XMLHTTPREQUEST</code></td> + <td><code>11</code></td> + <td><font><font>表示{{domxref(“XMLHttpRequest的”)}}。</font><font>也用於{{domxref(“Document.load()”)}} {{gecko_minversion_inline(“1.9”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_OBJECT_SUBREQUEST</code></td> + <td><code>12</code></td> + <td><font><font>表示由一個插件的請求。</font><font>{{gecko_minversion_inline(“1.9”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_DTD</code></td> + <td><code>13</code></td> + <td><font><font>表示通過XML加載的DTD </font></font><code>document</code><font><font>。</font><font>{{gecko_minversion_inline(“1.9”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_FONT</code></td> + <td><code>14</code></td> + <td><font><font>指示經由{{cssxref(“@字體面”)}}規則加載的字體。</font><font>{{gecko_minversion_inline(“1.9.1”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_MEDIA</code></td> + <td><code>15</code></td> + <td><font><font>表示視頻或音頻負載。</font><font>{{gecko_minversion_inline(“1.9.1”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_WEBSOCKET</code></td> + <td><code>16</code></td> + <td><font><font><font><font>表示</font></font></font></font><a href="/en-US/docs/Web/API/WebSocket_API"><font><font><font><font>的WebSocket的</font></font></font></font></a><font><font><font><font>負荷。</font></font></font><font><font><font>{{gecko_minversion_inline(“11”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>TYPE_CSP_REPORT</code></td> + <td><code>17</code></td> + <td><font><font>表示一個</font></font><a href="/en-US/docs/Web/Security/CSP"><font><font>內容安全策略</font></font></a><font><font>報告。</font><font>{{gecko_minversion_inline(“20”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_XSLT</code></td> + <td><code>18</code></td> + <td><font><font>表示一個樣式表轉換。</font><font>{{gecko_minversion_inline(“27”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_BEACON</code></td> + <td><code>19</code></td> + <td><font><font>表示信標後。</font><font>{{gecko_minversion_inline(“30”)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_FETCH</code></td> + <td><font><font><font><font>20</font></font></font></font></td> + <td><font><font>指示通過發起的負載的{{domxref(“GlobalFetch.fetch()”)}}方法,其可作為在全球都{{domxref(“窗口”)}}和{{domxref(“工人”)} }上下文。</font><font>{{gecko_minversion_inline(36)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_IMAGESET</code></td> + <td><font><font><font><font>21</font></font></font></font></td> + <td><font><font>指示要加載的{{HTML元素(“IMG”)}}(與該{{htmlattrxref(“srcset”,“IMG”)}}屬性或{{HTMLElement的(“圖片”)}}。{{gecko_minversion_inline(請求36)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_WEB_MANIFEST</code></td> + <td><font><font><font><font>22</font></font></font></font></td> + <td><font><font>指示要加載一個Web清單的請求。</font><font>{{gecko_minversion_inline(41)}}</font></font></td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_SCRIPT</code></td> + <td><font><font><font><font>23</font></font></font></font></td> + <td> + <p><font><font>用於表示使用{{HTMLElement的(“腳本”)}}元素加載的腳本的內部常數。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font>重要說明:</font></font></strong><font><font>此類型映射到</font></font><code>TYPE_SCRIPT</code><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_WORKER</code></td> + <td><font><font><font><font>24</font></font></font></font></td> + <td> + <p><font><font>用於表示通過專用工人加載的腳本的內部常數。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_SCRIPT</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_SHARED_WORKER</code></td> + <td><font><font><font><font>25</font></font></font></font></td> + <td> + <p><font><font>用於表示通過共享工人加載的腳本的內部常數。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_SCRIPT</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_EMBED</code></td> + <td><font><font><font><font>26</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTML元素(“嵌入”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_OBJECT</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_OBJECT</code></td> + <td><font><font><font><font>27</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTMLElement的(“對象”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_OBJECT</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_FRAME</code></td> + <td><font><font><font><font>28</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTML元素(“幀”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_SUBDOCUMENT</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_IFRAME</code></td> + <td><font><font><font><font>29</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTML元素(“IFRAME”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_SUBDOCUMENT</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_AUDIO</code></td> + <td><font><font><font><font>30</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTML元素(“音頻”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_MEDIA</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_VIDEO</code></td> + <td><font><font><font><font>31</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTML元素(“視頻”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_MEDIA</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>TYPE_INTERNAL_TRACK</code></td> + <td><font><font><font><font>32</font></font></font></font></td> + <td> + <p><font><font>內部常量用於表示從{{HTML元素(“軌道”)}}元素加載的內容。</font><font>{{gecko_minversion_inline(41)}}</font></font></p> + + <div class="warning"> + <p><strong><font><font><font><font>重要說明:</font></font></font></font></strong><font><font><font><font>此類型映射到</font></font></font></font><code>TYPE_MEDIA</code><font><font><font><font>傳遞給內容政策實施之前,不宜在室外的Gecko內核代碼中使用。</font></font></font></font></p> + </div> + </td> + </tr> + <tr> + <td><code>REJECT_REQUEST</code></td> + <td><code>-1</code></td> + <td><font><font>從{{manch(“shouldLoad”)}}或{{manch(“為ShouldProcess”)}}返回如果負載或處理請求是基於所述請求的細節拒絕。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>REJECT_TYPE</code></td> + <td><code>-2</code></td> + <td> + <p><font><font>從{{manch(“shouldLoad”)}}或{{manch(“為ShouldProcess”)}}返回如果負載/過程僅僅基於(上述標誌)它的類型拒絕。</font></font></p> + <font><font>{{注(“這甩只適用於該服務器上的當前請求,而不是同一類型的未來需求。”)}} {{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>REJECT_SERVER</code></td> + <td><code>-3</code></td> + <td> + <p><font><font>從{{manch(“shouldLoad”)}}或{{manch(“為ShouldProcess”)}}如果負載/過程是基於在服務器上拒絕它託管在或從請求(返回</font></font><code>aContentLocation</code><font><font>或</font></font><code>aRequestOrigin</code><font><font>),例如,如果塊的</font></font><code>IMAGE</code><font><font>,因為它是從goatse.cx服務(即使你不一定阻止</font></font><code>other</code><font><font>從該服務器/域類型)。</font></font></p> + <font><font><font><font>{{注(“這甩只適用於該服務器上的當前請求,而不是同一類型的未來需求。”)}} {{gecko_minversion_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>REJECT_OTHER</code></td> + <td><code>-4</code></td> + <td> + <p><font><font>從{{manch(“shouldLoad”)}}或返回{{manch(“為ShouldProcess”)}}如果負載/過程是基於一些拒絕</font></font><code>other</code><font><font>標準。</font><font>Mozilla的呼叫者會處理這個喜歡</font></font><code>REJECT_REQUEST</code><font><font>; </font><font>第三方實現者,例如,用這個來指導自己的來電諮詢額外參數的更多細節。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></p> + + <p><font><font>{{注(“這甩只適用於該服務器上的當前請求,而不是同一類型的未來需求。”)}}</font></font></p> + </td> + </tr> + <tr> + <td><code>ACCEPT</code></td> + <td><code>1</code></td> + <td><font><font>從{{manch(“shouldLoad”)}}或{{manch(“為ShouldProcess”)}}如果負載或處理請求不被拒絕返回。</font><font>{{gecko_minversion_inline(“1.8”)}}</font></font></td> + </tr> + <tr> + <td><code>OTHER</code></td> + <td><code>0</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>SCRIPT</code></td> + <td><code>1</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>IMAGE</code></td> + <td><code>2</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>STYLESHEET</code></td> + <td><code>3</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>OBJECT</code></td> + <td><code>4</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>SUBDOCUMENT</code></td> + <td><code>5</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>CONTROL_TAG</code></td> + <td><code>6</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>RAW_URL</code></td> + <td><code>7</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + <tr> + <td><code>DOCUMENT</code></td> + <td><code>8</code></td> + <td><font><font><font><font>{{obsolete_inline(“1.8”)}}</font></font></font></font></td> + </tr> + </tbody> +</table> + +<h2 id="Methods" name="Methods"><font><font><font><font>方法</font></font></font></font></h2> + +<h3 id="shouldLoad()" name="shouldLoad()"><font><font><font><font>shouldLoad()</font></font></font></font></h3> + +<p><font><font>打電話讓自己的內容政策的執行決定在給定位置的資源是否應該被加載。</font><font>這種方法是通過加載指定aContentLocation的資源,以確定是否要開始加載所請求的資源之前調用。</font></font></p> + +<p class="note"><code>shouldLoad()</code><font><font>可以稱為同時所涉及的文檔的DOM和佈局是不一致的狀態。</font><font>這意味著,該方法的實施者</font></font><strong><font><font>不得</font></font></strong><font><font>做任何以下內容:</font></font></p> + +<ol> + <li class="note"><font><font>以任何方式修改DOM中(例如,設置屬性是一個沒有沒有)。</font></font></li> + <li class="note"><font><font>查詢依賴於佈局(例如,任何DOM屬性</font></font><code>offset*</code><font><font>屬性)。</font></font></li> + <li class="note"><font><font>查詢依賴於任何風格的DOM屬性(例如,計算方式)。</font></font></li> + <li class="note"><font><font>查詢依賴於DOM的當前狀態的“上下文”節點(例如,節點列表的長度)之外的任何DOM屬性。</font></font></li> + <li class="note"><font><font>[JavaScript實現僅]不使用XPCNativeWrapper(顯式或隱式地)的任何對象上的任何類型的訪問屬性。</font><font>由於各種DOM0的事情,這會導致項目4。</font></font></li> +</ol> + +<p class="note"><font><font>如果你在做這些事情</font></font><code>shouldLoad()</code><font><font>的實現,期望不可預知的行為,可能包括死機,沒有顯示出來的內容,內容顯示了一倍,等等。如果你不需要做任何的事情上面,做他們關閉超時或事件。</font></font></p> + +<div class="note"><strong><font><font>注</font></font></strong><font><font>:當多個內容策略用於(例如,通過幾個擴展),如果其中一人拒絕的請求,該政策的其餘部分不叫。</font><font>參考:</font></font><a class="external" href="http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsContentPolicy.cpp#146" title="http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsContentPolicy.cpp#146"><font><font>http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsContentPolicy.cpp#146</font></font></a><font><font>。</font></font></div> + +<div class="note"><strong><font><font>注</font></font></strong><font><font>:內容政策在上述情況下的順序取決於安裝的優先級。</font></font></div> + +<pre class="eval"><font><font>短shouldLoad(</font></font><font><font> + 在無符號長aContentType,</font></font><font><font> + 在nsIURI aContentLocation,</font></font><font><font> + 在nsIURI aRequestOrigin,</font></font><font><font> + 在nsISupports aContext,</font></font><font><font> + 在ACString aMimeTypeGuess,</font></font><font><font> + 在nsISupports aExtra,</font></font><font><font> + 在nsIPrincipal aRequestPrincipal</font></font><font><font> +);</font></font> +</pre> + +<h6 id="Parameters" name="Parameters"><font><font>參數</font></font></h6> + +<dl> + <dt><code>aContentType</code></dt> + <dd><font><font>的類型的內容進行測試。</font><font>這將是一個一個{{ANCH(“內容類型”)}}在上面列出。</font></font></dd> + <dt><code>aContentLocation</code></dt> + <dd><font><font>的內容的URI被檢查; </font><font>一定不能</font></font><code>null</code><font><font>。</font></font></dd> + <dt><code>aRequestOrigin</code><font><font><font><font> {optional_inline}}</font></font></font></font></dt> + <dd><font><font>啟動此加載請求的資源的位置; </font><font>可</font></font><code>null</code><font><font>如果不適用。</font></font></dd> + <dt><code>aContext</code><font><font><font><font> {optional_inline}}</font></font></font></font></dt> + <dd><font><font>的{{接口(“nsIDOMNode”)}}或{{接口(“nsIDOMWindow”)}}發起請求,或一些可以</font></font><code>QueryInterface()</code><font><font>向其中的一個; </font><font>可</font></font><code>null</code><font><font>如果不適用。</font></font></dd> + <dt><font><font>{{音符(“aContext是當用戶使用的上下文菜單中的新選項卡/窗口或CMD / CTRL +打開鏈接的新選項卡/窗口點擊鏈接(即,aContext不是該鏈路是在拉片在這些情況下)。“)}}</font></font></dt> + <dt> </dt> + <dt> </dt> + <dt><code>aMimeTypeGuess</code></dt> + <dd><font><font>可選的。</font><font>用於所請求的內容的MIME類型猜測,基於可用於請求發起(例如,信息</font></font><code>OBJECT</code><font><font>的類型屬性); </font><font>不能可靠地反映實際的MIME類型所請求的內容。</font></font></dd> + <dt><code>aExtra</code></dt> + <dd><font><font>一個可選的參數,直通非壁虎呼叫者額外的數據傳遞給被調用者。</font></font></dd> +</dl> + +<dl> + <dt><code style="font-size: 14px;">aRequestPrincipal</code></dt> + <dd><font><font>可選的。</font><font>定義了導致負載的主體。</font><font>這僅適用於可選</font></font><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=803765#c9"><font><font>的非壁虎</font></font></a><font><font>代碼:所有的壁虎代碼應該設置此參數。</font><font>對於導航事件,這是導致該加載頁面的主體。</font></font></dd> +</dl> + +<h6 id="Return_value" name="Return_value"><font><font><font><font>返回值</font></font></font></font></h6> + +<p><code>ACCEPT</code><font><font><font><font> 要么 </font></font></font></font><code>REJECT_*</code></p> + +<h3 id="shouldProcess()" name="shouldProcess()"><font><font>為ShouldProcess()</font></font></h3> + +<p><font><font>如果資源被處理?</font><font>{{manch(“為ShouldProcess”)}}將被調用一次傳遞給它的所有資料已被確定有關資源,資源的一部分已經被加載後一般。</font><font>“處理”是指通過處理應用程序。</font><font>例如,為ShouldProcess可以用來允許來自服務器的響應根據MIME類型的響應的處理或忽略。</font></font></p> + +<p><font><font>{{NoteStart()}} {{manch(“為ShouldProcess”)}}可以被稱為當DOM和佈局</font></font><code>document</code><font><font>涉及處於不一致的狀態。</font><font>查看{{manch(“shouldLoad”)}}筆記,看看這是什麼意思了這種方法的實現者。{{NoteEnd()}}</font></font></p> + +<pre class="eval"><font><font>短為ShouldProcess(</font></font><font><font> + 在無符號長aContentType,</font></font><font><font> + 在nsIURI aContentLocation,</font></font><font><font> + 在nsIURI aRequestOrigin,</font></font><font><font> + 在nsISupports aContext,</font></font><font><font> + 在ACString aMimeType,</font></font><font><font> + 在nsISupports aExtra,</font></font><font><font> + 在nsIPrincipal aRequestPrincipal</font></font><font><font> +);</font></font> +</pre> + +<h6 id="Parameters" name="Parameters"><font><font><font><font>參數</font></font></font></font></h6> + +<dl> + <dt><code>aContentType</code></dt> + <dd><font><font>的類型的內容進行測試。</font><font>這將是TYPE_ *常量之一。</font></font></dd> + <dt><code>aContentLocation</code></dt> + <dd><font><font>可選的。</font><font>被請求的資源的位置:可能是,例如,一個重定向後的URI資源。</font></font></dd> + <dt><code>aRequestOrigin</code></dt> + <dd><font><font>可選的。</font><font>啟動此加載請求的資源的位置; </font><font>可</font></font><code>null</code><font><font>如果不適用。</font></font></dd> + <dt><code>aContext</code></dt> + <dd><font><font>可選的。</font><font>的{{接口(“nsIDOMNode”)}}或發起請求{{接口(“nsIDOMWindow”)}},或一些可以查詢接口的那些中的一個; </font><font>可</font></font><code>null</code><font><font>如果不適用。</font></font></dd> + <dt><code>aMimeType</code></dt> + <dd><font><font>MIME類型所請求的資源(例如,圖像/ PNG)的,所報告的網絡庫,如果可用的話(可以是空的,如果不適合的類型,例如,</font></font><code>TYPE_REFRESH</code><font><font>)。</font></font></dd> + <dt><code>aExtra</code></dt> + <dd><font><font><font><font>一個可選的參數,直通非壁虎呼叫者額外的數據傳遞給被調用者。</font></font></font></font></dd> +</dl> + +<dl> + <dt><code style="font-size: 14px;">aRequestPrincipal</code></dt> + <dd><font><font>可選的。</font><font>提出請求的主體。</font></font></dd> +</dl> + +<h6 id="Return_value" name="Return_value"><font><font><font><font>返回值</font></font></font></font></h6> + +<p><code>ACCEPT</code><font><font><font><font> 要么 </font></font></font></font><code>REJECT_*</code></p> + +<h2 id="Example" name="Example"><font><font><font><font>例</font></font></font></font></h2> + +<p><font><font>您可以通過包括容易實現這個接口</font></font><code>nsIContentPolicy.h</code><font><font>的頭文件和實現</font></font><code>public nsIContentPolicy</code><font><font>到類,如下所示:</font></font></p> + +<pre class="brush: cpp"><font><font>//將這個變成你的頭文件</font></font> +<font><font> +#包括“_path_to_sdk /包括/內容/ nsIContentPolicy.h”</font></font> +<font><font> +MyClass類:公共nsISupports,公共nsIContentPolicy {</font></font><font><font> + ...</font></font><font><font> + NS_DECL_NSICONTENTPOLICY</font></font><font><font> + ...</font></font><font><font> +}</font></font> +<font><font> +//這到您的實現文件 </font></font><font><font> +NS_IMPL_ISUPPORTSn(MyClass的,nsISupports,nsIContentPolicy,...)</font></font> +</pre> + +<p><font><font>{{NoteStart()}}之前,你能接受的通知,你必須註冊你的插件{{接口(“nsICategoryManager”)}}。</font><font>見下面的例子。{{NoteEnd()}}</font></font></p> + +<pre class="brush: cpp"><font><font><font><font>字符*以前= nsnull; </font></font></font></font> +<font><font><font><font> +nsCOMPtr的的<nsICategoryManager> catman; </font></font></font></font> +<font><font><font><font> +servman-> GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID,</font></font></font></font><font><font><font><font> +NS_GET_IID(nsICategoryManager)</font></font></font></font><font><font><font><font> +getter_AddRefs(catman)); </font></font></font></font> +<font><font><font><font> +RV = catman-> AddCategoryEntry(“內容的策略”,</font></font></font></font><font><font><font><font> +COMPONENT_CLASSNAME,</font></font></font></font><font><font><font><font> +COMPONENT_CONTRACTID,</font></font></font></font><font><font><font><font> +PR_TRUE, </font></font></font></font><font><font><font><font> +PR_TRUE,</font><font>&</font></font></font></font><font><font><font><font> +以前);</font></font></font></font></pre> + +<p><font><font>JavaScript開發人員也可以</font></font><a href="/en/XUL_School/Intercepting_Page_Loads#Content_Policy" title="EN / XUL學校/攔截頁面加載#內容策略"><font><font>實現XPCOM組件</font></font></a><font><font>擴展</font></font><code>nsIContentPolicy</code><font><font>。</font></font></p> diff --git a/files/zh-tw/mozilla/thunderbird/autoconfiguration/fileformat/howto/index.html b/files/zh-tw/mozilla/thunderbird/autoconfiguration/fileformat/howto/index.html new file mode 100644 index 0000000000..fafd0dffa0 --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/autoconfiguration/fileformat/howto/index.html @@ -0,0 +1,199 @@ +--- +title: 'Autoconfig: How to create a configuration file' +slug: Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo +translation_of: Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo +--- +<h2 id="Definition">Definition</h2> +<h2 id="Authoritative_definition"><a class="link-https" href="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat" title="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat">Authoritative definition</a></h2> +<h2 id="Example">Example</h2> +<h2 id="Real-world_example"><a class="link-https" href="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de" title="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de">Real-world example</a></h2> +<h2 id="sect1"> </h2> +<h2 id="<xml_version1.0_encodingUTF-8>"><?xml version="1.0" encoding="UTF-8"?></h2> +<h2 id="<clientConfig_version1.1>_<emailProvider_idfreenet.de>_<domain>freenet.de<domain>_<displayName>Freenet_Mail<displayName>_<displayShortName>Freenet<displayShortName>_<incomingServer_typeimap>_<hostname>imap.freenet.de<hostname>_<port>993<port>_<socketType>SSL<socketType>_<authentication>password-encrypted<authentication>_<username>EMAILADDRESS<username>_<incomingServer>_<incomingServer_typeimap>_<hostname>imap.freenet.de<hostname>_<port>143<port>_<socketType>STARTTLS<socketType>_<authentication>password-encrypted<authentication>_<username>EMAILADDRESS<username>_<incomingServer>_<incomingServer_typepop3>_<hostname>pop.freenet.de<hostname>_<port>995<port>_<socketType>SSL<socketType>_<authentication>password-cleartext<authentication>_<username>EMAILADDRESS<username>_<incomingServer>_<incomingServer_typepop3>_<hostname>pop.freenet.de<hostname>_<port>110<port>_<socketType>STARTTLS<socketType>_<authentication>password-cleartext<authentication>_<username>EMAILADDRESS<username>_<incomingServer>_<outgoingServer_typesmtp>_<hostname>smtp.freenet.de<hostname>_<port>465<port>_<socketType>SSL<socketType>_<authentication>password-encrypted<authentication>_<username>EMAILADDRESS<username>_<outgoingServer>_<outgoingServer_typesmtp>_<hostname>smtp.freenet.de<hostname>_<port>587<port>_<socketType>STARTTLS<socketType>_<authentication>password-encrypted<authentication>_<username>EMAILADDRESS<username>_<outgoingServer>_<documentation_urlhttpkundenservice.freenet.dehilfeemailprogrammeconfigindex.html>_<descr_langde>Allgemeine_Beschreibung_der_Einstellungen<descr>_<descr_langen>Generic_settings_page<descr>_<documentation>_<documentation_urlhttpkundenservice.freenet.dehilfeemailprogrammeconfigthunderbirdimap-thunderbirdimapindex.html>_<descr_langde>TB_2.0_IMAP-Einstellungen<descr>_<descr_langen>TB_2.0_IMAP_settings<descr>_<documentation>_<emailProvider>_<clientConfig>"><<span class="start-tag">clientConfig</span><span class="attribute-name"> version</span>=<span class="attribute-value">"1.1"</span>><br> + <<span class="start-tag">emailProvider</span><span class="attribute-name"> id</span>=<span class="attribute-value">"freenet.de"</span>><br> + <<span class="start-tag">domain</span>>freenet.de</<span class="end-tag">domain</span>><br> + <<span class="start-tag">displayName</span>>Freenet Mail</<span class="end-tag">displayName</span>><br> + <<span class="start-tag">displayShortName</span>>Freenet</<span class="end-tag">displayShortName</span>><br> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"imap"</span>><br> + <<span class="start-tag">hostname</span>>imap.freenet.de</<span class="end-tag">hostname</span>><br> + <<span class="start-tag">port</span>>993</<span class="end-tag">port</span>><br> + <<span class="start-tag">socketType</span>>SSL</<span class="end-tag">socketType</span>><br> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>><br> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>><br> + </<span class="end-tag">incomingServer</span>><br> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"imap"</span>><br> + <<span class="start-tag">hostname</span>>imap.freenet.de</<span class="end-tag">hostname</span>><br> + <<span class="start-tag">port</span>>143</<span class="end-tag">port</span>><br> + <<span class="start-tag">socketType</span>>STARTTLS</<span class="end-tag">socketType</span>><br> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>><br> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>><br> + </<span class="end-tag">incomingServer</span>><br> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"pop3"</span>><br> + <<span class="start-tag">hostname</span>>pop.freenet.de</<span class="end-tag">hostname</span>><br> + <<span class="start-tag">port</span>>995</<span class="end-tag">port</span>><br> + <<span class="start-tag">socketType</span>>SSL</<span class="end-tag">socketType</span>><br> + <<span class="start-tag">authentication</span>>password-cleartext</<span class="end-tag">authentication</span>><br> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>><br> + </<span class="end-tag">incomingServer</span>><br> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"pop3"</span>><br> + <<span class="start-tag">hostname</span>>pop.freenet.de</<span class="end-tag">hostname</span>><br> + <<span class="start-tag">port</span>>110</<span class="end-tag">port</span>><br> + <<span class="start-tag">socketType</span>>STARTTLS</<span class="end-tag">socketType</span>><br> + <<span class="start-tag">authentication</span>>password-cleartext</<span class="end-tag">authentication</span>><br> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>><br> + </<span class="end-tag">incomingServer</span>><br> + <<span class="start-tag">outgoingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"smtp"</span>><br> + <<span class="start-tag">hostname</span>>smtp.freenet.de</<span class="end-tag">hostname</span>><br> + <<span class="start-tag">port</span>>465</<span class="end-tag">port</span>><br> + <<span class="start-tag">socketType</span>>SSL</<span class="end-tag">socketType</span>><br> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>><br> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>><br> + </<span class="end-tag">outgoingServer</span>><br> + <<span class="start-tag">outgoingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"smtp"</span>><br> + <<span class="start-tag">hostname</span>>smtp.freenet.de</<span class="end-tag">hostname</span>><br> + <<span class="start-tag">port</span>>587</<span class="end-tag">port</span>><br> + <<span class="start-tag">socketType</span>>STARTTLS</<span class="end-tag">socketType</span>><br> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>><br> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>><br> + </<span class="end-tag">outgoingServer</span>><br> + <<span class="start-tag">documentation</span><span class="attribute-name"> url</span>=<span class="attribute-value">"http://kundenservice.freenet.de/hilfe/email/programme/config/index.html"</span>><br> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"de"</span>>Allgemeine Beschreibung der Einstellungen</<span class="end-tag">descr</span>><br> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"en"</span>>Generic settings page</<span class="end-tag">descr</span>><br> + </<span class="end-tag">documentation</span>><br> + <<span class="start-tag">documentation</span><span class="attribute-name"> url</span>=<span class="attribute-value">"http://kundenservice.freenet.de/hilfe/email/programme/config/thunderbird/imap-thunderbird/imap/index.html"</span>><br> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"de"</span>>TB 2.0 IMAP-Einstellungen</<span class="end-tag">descr</span>><br> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"en"</span>>TB 2.0 IMAP settings</<span class="end-tag">descr</span>><br> + </<span class="end-tag">documentation</span>><br> + </<span class="end-tag">emailProvider</span>><br> + </<span class="end-tag">clientConfig</span>></h2> +<h2 id="How_to_probe_mail_servers">How to probe mail servers</h2> +<h2 id="To_determine_a_server's_capabilities_you_can_contact_the_server_directly_and_talk_the_POPIMAPSMTP_protocol_manually_(assuming_you_already_know_the_hostname)._For_non-SSL_use_netcat_-v_hostname_port_(preferred)_or_telnet_hostname_port_as_client.">To determine a server's capabilities, you can contact the server directly and talk the POP/IMAP/SMTP protocol manually (assuming you already know the hostname).<br> + For non-SSL, use <strong><code>netcat -v <em>hostname</em> <em>port</em></code></strong> (preferred) or <code>telnet <em>hostname</em> <em>port</em></code> as "client".</h2> +<ul> + <li> + <h2 id="POP3_port_110_when_you_see_OK_WEB.DE_POP3-Server_or_similar_enter_CAPA_hit_return.">POP3, port 110: when you see <code>+OK WEB.DE POP3-Server</code> or similar, enter <code><strong>CAPA</strong></code>, hit return.</h2> + </li> + <li> + <h2 id="IMAP_port_143_when_you_see_*_OK_mwinf2j04_IMAP4_server_ready_or_similar_enter_1_CAPABILITY_hit_return.">IMAP, port 143: when you see <code>* OK mwinf2j04 IMAP4 server ready</code> or similar, enter <code><strong>1 CAPABILITY</strong></code>, hit return.</h2> + </li> + <li> + <h2 id="SMTP_port_587_or_25_when_you_see_220_mail.gmx.net_GMX_Mailservices_ESMTP_or_similar_enter_EHLO_example.net_hit_return.">SMTP, port 587 or 25: when you see <code>220 mail.gmx.net GMX Mailservices ESMTP</code> or similar, enter <code><strong>EHLO example.net</strong></code>, hit return.</h2> + </li> +</ul> +<h2 id="In_all_cases_the_server_should_respond_with_a_list_of_capabilities.">In all cases, the server should respond with a list of capabilities.</h2> +<h2 id="SSL_STARTTLS">SSL / STARTTLS</h2> +<h2 id="There_are_2_SSL_variants_normal_SSL_and_STARTTLS.">There are 2 SSL variants: normal SSL and STARTTLS.</h2> +<h2 id="Normal_SSL">Normal SSL</h2> +<h2 id="The_old-style_SSL_(including_TLS_which_is_just_the_new_name_for_SSL)_has_a_special_port">The old-style SSL (including TLS, which is just the new name for SSL) has a special port:</h2> +<ul> + <li> + <h2 id="POP3_via_SSL_port_995">POP3 via SSL: port 995</h2> + </li> + <li> + <h2 id="IMAP_via_SSL_port_993">IMAP via SSL: port 993</h2> + </li> + <li> + <h2 id="SMTP_via_SSL_port_465">SMTP via SSL: port 465</h2> + </li> +</ul> +<h2 id="On_Linux_you_can_contact_the_server_via">On Linux, you can contact the server via</h2> +<pre></pre> +<h2 id="openssl_s_client_-connect_hostnameport"><strong>openssl s_client -connect <em>hostname</em>:<em>port</em></strong></h2> +<h2 id="You_should_see_output_about_the_SSL_handshake_and_the_certificate._Important_is_what_is_listed_as_CN._This_must_be_the_same_as_the_hostname_that_you_contacted_otherwise_the_certificate_is_not_valid_(or_you_need_to_use_another_hostname)._If_you_see_nothing_then_probably_the_server_does_not_support_SSL._After_that_you_can_have_the_same_protocol_exchange_as_with_netcat_on_standard_ports_as_listed_above.">You should see output about the SSL handshake and the certificate. Important is what is listed as "CN=". This must be the same as the hostname that you contacted, otherwise the certificate is not valid (or you need to use another hostname).<br> + If you see nothing, then probably the server does not support SSL.<br> + After that, you can have the same protocol exchange as with netcat on standard ports, as listed above.</h2> +<h2 id="STARTTLS">STARTTLS</h2> +<h2 id="STARTTLS_is_a_special_new_form_of_SSL_which_works_on_the_standard_ports_(e.g._port_143_for_IMAP)._You_can_contact_the_server_via_netcat_as_mentioned_above._If_you_see_STARTTLS_(for_IMAP_SMTP)_or_STLS_(for_POP)_listed_as_one_of_the_capabilities_the_server_should_support_STARTTLS._To_try_it_out_on_Linux_you_can_contact_the_server_via">STARTTLS is a special, new form of SSL, which works on the standard ports (e.g. port 143 for IMAP). You can contact the server via netcat as mentioned above. If you see "STARTTLS" (for IMAP, SMTP) or "STLS" (for POP) listed as one of the capabilities, the server should support STARTTLS.<br> + To try it out, on Linux, you can contact the server via</h2> +<h2 id="sect2"> </h2> +<h2 id="openssl_s_client_-connect_hostnameport_-starttls_proto">openssl s_client -connect <em>hostname</em>:<em>port</em> -starttls <em>proto</em></h2> +<h2 id="...where_proto_is_imap_pop3_or_smtp._For_example">...where "proto" is <code>imap</code>, <code>pop3</code> or <code>smtp</code>. For example:</h2> +<pre></pre> +<h2 id="openssl_s_client_-connect_imap.example.com143_-starttls_imap"><strong>openssl s_client -connect <em>imap.example.com</em>:<em>143</em> -starttls <em>imap</em></strong></h2> +<h2 id="You_should_get_the_same_response_as_described_above_for_openssl.">You should get the same response as described above for openssl.</h2> +<h2 id="Configuration_file_format">Configuration file format</h2> +<h2 id="Add_the_appropriate_port_and_socket_type_for_each_server_depending_on_protocol_and_SSL_support._For_example_for_IMAP_with_SSL">Add the appropriate port and socket type for each server, depending on protocol and SSL support. For example,<br> + for IMAP with SSL:</h2> +<h2 id="sect3"> </h2> +<h2 id="<port>993<port>"><port>993<port></h2> +<h2 id="<socketType>SSL<socketType>"><socketType>SSL</socketType></h2> +<h2 id="for_IMAP_with_STARTTLS">for IMAP with STARTTLS:</h2> +<h2 id="sect4"> </h2> +<h2 id="<port>143<port>_<socketType>STARTTLS<socketType>"><port>143<port><br> + <socketType>STARTTLS</socketType></h2> +<h2 id="for_IMAP_without_any_SSL_(deprecated!)">for IMAP without any SSL (deprecated!):</h2> +<h2 id="sect5"> </h2> +<h2 id="<port>143<port>"><port>143<port></h2> +<h2 id="<socketType>plain<socketType>"><socketType>plain</socketType></h2> +<h2 id="Use_SSL">Use SSL</h2> +<h2 id="Please_do_not_submit_or_serve_any_configurations_without_SSL!_There's_no_reason_in_2010_why_users_still_need_to_read_mail_entirely_unprotected._If_you_are_an_ISP_and_think_the_server_load_is_too_high_try_adding_an_SSL_accelerator._They_are_cheap_and_widely_used._In_fact_even_most_freemail_(!)_providers_these_days_support_SSL_so_if_users_pay_you_money_for_ISP_service_that's_all_the_more_reason_to_give_them_proper_service._But_first_simply_try_to_enable_software_SSL_-_small_servers_may_be_fine_with_SSL_and_without_any_additional_installations.">Please do not submit or serve any configurations without SSL! There's no reason in 2010 why users still need to read mail entirely unprotected.<br> + If you are an ISP and think the server load is too high, try adding an SSL accelerator. They are cheap and widely used. In fact, even most freemail (!) providers these days support SSL, so if users pay you money for ISP service, that's all the more reason to give them proper service. But first simply try to enable software SSL - small servers may be fine with SSL and without any additional installations.</h2> +<h2 id="Valid_certificate">Valid certificate</h2> +<h2 id="Either_way_be_sure_to_use_a_valid_certificate">Either way, be sure to use a valid certificate:</h2> +<ul> + <li> + <h2 id="issued_by_a_CA_recognized_by_Firefox_Thunderbird">issued by a CA recognized by Firefox / Thunderbird</h2> + </li> + <li> + <h2 id="not_expired">not expired</h2> + </li> + <li> + <h2 id="the_CN_in_the_cert_must_match_the_hostname_that_Thunderbird_contacts_and_that_is_listed_as_<hostname>_in_the_configuration_file._If_they_don't_match_Thunderbird_must_assume_that_the_user_may_be_under_attack_otherwise_the_SSL_guarantees_no_longer_hold._Thunderbird_either_warns_the_user_or_ignores_the_server._(Note_that_you_can_get_certificates_for_free_these_days_for_example_from_startssl.com.)">the CN in the cert must match the hostname that Thunderbird contacts and that is listed as <hostname> in the configuration file. If they don't match, Thunderbird must assume that the user may be under attack, otherwise the SSL guarantees no longer hold. Thunderbird either warns the user or ignores the server. (Note that you can get certificates for free these days, for example from startssl.com.)</h2> + </li> +</ul> +<h2 id="Authentication">Authentication</h2> +<h2 id="Probe_the_mail_server_as_explained_above_for_STARTTLS._If_you_see_CRAM-MD5_or_APOP_in_the_response_the_server_should_support_encrypted_passwords._If_you_only_see_AUTH_LOGIN_andor_PLAIN_or_no_AUTH_at_all_the_server_probably_does_not_support_secure_authentication._In_the_former_case_select_Encrypted_passwords_as_Authentication_method_(in_Thunderbird_Account_Settings_UI_incoming_server_and_SMTP_server)_and_test_whether_you_can_actually_log_in_with_a_real_account_(because_some_servers_are_unfortunately_broken_with_regards_to_authentication_often_due_to_a_wrong_or_misconfigured_SASL_installation)."><span class="external free">Probe the mail server, as explained above for STARTTLS.</span> If you see <code>CRAM-MD5</code> or <code>APOP</code> in the response, the server should support encrypted passwords. If you <em>only</em> see <code>AUTH</code> <code>LOGIN</code> and/or <code>PLAIN</code>, or no <code>AUTH</code> at all, the server probably does not support secure authentication. In the former case, select "Encrypted passwords" as "Authentication method" (in Thunderbird Account Settings UI, incoming server and SMTP server), and test whether you can actually log in with a real account (because some servers are unfortunately broken with regards to authentication, often due to a wrong or misconfigured SASL installation).</h2> +<h2 id="Configuration_file_format_2">Configuration file format</h2> +<h2 id="In_the_configuration_file_for_each_IMAP_POP_and_SMTP_server_you_need_to_specify_the_authentication_method._For_plaintext_passwords">In the configuration file, for each IMAP, POP and SMTP server, you need to specify the authentication method.<br> + <br> + For plaintext passwords:</h2> +<h2 id="sect6"> </h2> +<h2 id="<authentication>password-cleartext<authentication>"><authentication>password-cleartext</authentication></h2> +<h2 id="For_CRAM-MD5">For CRAM-MD5:</h2> +<h2 id="sect7"> </h2> +<h2 id="<authentication>password-encrypted<authentication>"><authentication>password-encrypted</authentication></h2> +<h2 id="Discouraged_settings_(SMTP_only)_If_the_SMTP_server_can_only_be_used_after_checking_incoming_mail_please_use"><br> + Discouraged settings (SMTP only):<br> + If the SMTP server can only be used after checking incoming mail, please use</h2> +<h2 id="sect8"> </h2> +<h2 id="<authentication>smtp-after-pop<authentication>"><authentication>smtp-after-pop</authentication></h2> +<h2 id="Note_that_RFC_4409_disallows_that_and_requires_the_customer-facing_SMTP_server_to_support_proper_authentication_via_AUTH._If_the_SMTP_server_can_only_be_used_within_the_ISP's_network_and_requires_no_authentication_use">Note that RFC 4409 disallows that and requires the customer-facing SMTP server to support proper authentication via AUTH.<br> + If the SMTP server can only be used within the ISP's network, and requires no authentication, use:</h2> +<h2 id="sect9"> </h2> +<h2 id="<authentication>client-IP-address<authentication>"><authentication>client-IP-address</authentication></h2> +<h2 id="or_if_it_requires_authentication_in_addition_to_the_user_being_in_the_ISP_network_use_e.g.">or, if it requires authentication in addition to the user being in the ISP network, use e.g.:</h2> +<h2 id="sect10"> </h2> +<h2 id="<authentication>password-cleartext<authentication>_2"><authentication>password-cleartext</authentication></h2> +<h2 id="<restriction>client-IP-address<restriction>"><restriction>client-IP-address</restriction></h2> +<h2 id="However_that_means_that_users_on_the_road_or_in_the_office_are_unable_to_send_mail_which_is_a_real_problem_for_many_of_our_users._This_violates_RFC_4409_as_well_and_is_an_outdated_configuration._Please_try_find_a_configuration_that_works_in_all_cases_for_the_sake_of_the_users.">However, that means that users on the road or in the office are unable to send mail, which is a real problem for many of our users. This violates RFC 4409 as well and is an outdated configuration. Please try find a configuration that works in all cases, for the sake of the users.</h2> +<h2 id="Please_support_MD5_passwords">Please support MD5 passwords</h2> +<h2 id="Please_support_authentication_with_CRAM-MD5._It_is_simple_to_implement_and_to_set_up_and_you_can_still_use_RADIUS_or_a_database_that_stores_passwords_in_plaintext_so_you_don't_need_to_make_changes_to_your_mail_server_or_authentication_infrastructure_apart_from_installing_some_software_and_configuring_it_correctly._CRAM-MD5_is_particularly_important_when_no_SSL_is_used_Never_make_users_send_their_passwords_in_plaintext_over_the_network!_(Not_even_in_your_ISP_network.)_We_warn_users_in_the_Mail_Account_Creation_dialog_about_such_insecure_configurations_and_we_reserve_the_right_to_block_them_in_the_future._As_an_ISP_you_should_ideally_store_passwords_in_encrypted_format_which_removes_the_risk_of_mass_password_theft_(and_possibly_reuse_on_other_sites)_if_somebody_hacks_your_servers._You_can_still_support_plaintext_passwords_in_this_case_and_encrypt_passwords_on_the_fly_before_comparing._(Users_who_use_plaintext_passwords_would_still_be_somewhat_exposed_but_at_least_you_don't_have_the_risk_of_the_whole_plaintext_password_database_being_stolen.)_You_can_use_both_plaintext_and_encrypted_authentication_transmission_with_plaintext_or_encrypted_password_databases_-_the_two_issues_are_independent.">Please support authentication with CRAM-MD5. It is simple to implement, and to set up, and you can still use RADIUS or a database that stores passwords in plaintext, so you don't need to make changes to your mail server or authentication infrastructure apart from installing some software and configuring it correctly. CRAM-MD5 is particularly important when no SSL is used: Never make users send their passwords in plaintext over the network! (Not even in your ISP network.) We warn users in the Mail Account Creation dialog about such insecure configurations, and we reserve the right to block them in the future.<br> + <br> + <span class="external free">As an ISP, you should ideally store passwords in encrypted format, which removes the risk of mass password theft (and possibly reuse on other sites) if somebody hacks your servers. You can still support plaintext passwords in this case, and encrypt passwords on the fly before comparing. (Users who use plaintext passwords would still be somewhat exposed, but at least you don't have the risk of the whole plaintext password database being stolen.) You can use both plaintext and encrypted authentication transmission with plaintext or encrypted password databases - the two issues are independent.</span></h2> +<h2 id="Username">Username</h2> +<h2 id="If_the_user's_IMAP_login_name_is_the_same_as_his_email_address_(for_example_if_fredexample.com_is_the_login_name)_add">If the user's IMAP login name is the same as his email address (for example, if "<a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a>" is the login name), add:</h2> +<h2 id="sect11"> </h2> +<h2 id="<username>EMAILADDRESS<username>"><username>%EMAILADDRESS%</username></h2> +<h2 id="Note_Use_EMAILADDRESS_as_literal._Thunderbird_will_replace_it_with_the_email_address_that_the_user_entered._Same_for_EMAILLOCALPART_and_other_placeholders."><span class="external free">Note: Use</span> %EMAILADDRESS% as literal. Thunderbird will replace it with the email address that the user entered. Same for %EMAILLOCALPART% and other placeholders.</h2> +<h2 id="If_the_login_name_is_the_same_as_the_first_segment_before_the_of_the_email_address_(for_example_fred_for_fredexample.com)_use"><span class="external free">If the login name is the same as the first segment before the @ of the email address (for example, "fred" for "<a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a>"), use:</span></h2> +<h2 id="sect12"> </h2> +<h2 id="<username>EMAILLOCALPART<username>"><username>%EMAILLOCALPART%</username></h2> +<h2 id="Aliases_or_username_not_part_of_email_address">Aliases, or username not part of email address</h2> +<h2 id="Note_that_the_above_must_be_true_for_any_email_address_that_the_user_would_set_up_-_even_for_aliases._You_can_ignore_aliases_like_info_if_that's_an_alias_for_fred_(or_both_fred_and_wilma)_and_Fred_would_set_up_fredexample.com_in_Thunderbird_not_info._If_however_Fred_can_set_up_heroexample.com_as_alias_for_fredexample.com_and_neither_hero_nor_heroexample.com_would_work_as_login_name_on_your_IMAP_server_you_need_to_set_up_a_lookup_of_alias_->_username_on_your_autoconfig_server._So_if_you_get_a_request_for_<httpautoconfig.example.commailc...roexample.com>_your_autconfig_server_must_have_a_script_which_responds_to_mailconfig-v1.1.xml_and_returns_the_concrete_username_for_example"><span class="external free">Note that the above must be true for any email address that the user would set up - even for aliases.<br> + <br> + You can ignore aliases like info@, if that's an alias for fred@ (or both fred@ and wilma@) and Fred would set up <a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a> in Thunderbird, not info@.<br> + <br> + If, however, Fred can set up <a class="link-mailto" href="mailto:hero@example.com" rel="freelink">hero@example.com</a> as alias for <a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a>, and neither "hero" nor "<a class="link-mailto" href="mailto:hero@example.com" rel="freelink">hero@example.com</a>" would work as login name on your IMAP server, you need to set up a lookup of alias -> username on your autoconfig server. So, if you get a request for <<a class="external" href="http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=hero@example.com" rel="freelink">http://autoconfig.example.com/mail/c...ro@example.com</a>>, your autconfig server must have a script which responds to /mail/config-v1.1.xml and returns the concrete username, for example:</span></h2> +<h2 id="sect13"> </h2> +<h2 id="<username>fred<username>"><username>fred</username></h2> +<h2 id="..._(or_<username>fredexample.com<username>_as_appropriate)_for_heroexample.com._This_is_the_only_way_to_enable_automatic_configuration_without_users_having_to_remember_what_their_primary_login_name_was_which_is_a_serious_problem_in_practical_experience._Even_if_you_have_told_them_all_the_necessary_information_in_your_welcome_letter_they_usually_cannot_find_the_letter._That's_exactly_where_autoconfiguration_tries_to_help.">... (or <username><a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a></username>, as appropriate) for <a class="link-mailto" href="mailto:hero@example.com" rel="freelink">hero@example.com</a>. This is the only way to enable automatic configuration without users having to remember what their primary login name was, which is a serious problem in practical experience. Even if you have told them all the necessary information in your welcome letter, they usually cannot find the letter. That's exactly where autoconfiguration tries to help.</h2> +<h2 id="Enable_visiturl">Enable visiturl</h2> +<h2 id="Some_providers_do_not_provide_IMAP_or_POP_service_by_default_but_require_it_to_be_enabled_via_a_web_UI._If_that_is_the_case_add_the_URL_that_a_logged-in_user_would_use_into_this_field_and_the_application_can_prompt_the_user_to_visit_it.">Some providers do not provide IMAP or POP service by default, but require it to be enabled via a web UI. If that is the case, add the URL that a logged-in user would use into this field, and the application can prompt the user to visit it.</h2> +<h2 id="This_is_not_yet_supported_by_Thunderbird_3.1_but_should_be_in_the_future_so_please_add_this_critical_information_where_it_applies.">This is <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586364" title="https://bugzilla.mozilla.org/show_bug.cgi?id=586364">not yet supported</a> by Thunderbird 3.1, but should be in the future, so please add this critical information where it applies.</h2> +<h2 id="If_you_are_an_ISP_please_by_all_means_avoid_this._It's_one_of_those_walls_against_which_users_run_the_hard_way.">If you are an ISP, please by all means avoid this. It's one of those "walls" against which users run the hard way.</h2> +<h2 id="Documentation_URL">Documentation URL</h2> +<h2 id="If_the_configuration_is_(partially)_based_on_a_help_webpage_of_the_ISP_that_describes_the_configuration_that_end_users_should_use_you_can_record_its_URL_here._You_may_add_several_of_them_as_several_elements._It_is_for_informational_purposes_only_and_mainly_for_the_maintenance_of_the_config_file_the_client_currently_does_not_use_them_at_all.">If the configuration is (partially) based on a help webpage of the ISP that describes the configuration that end users should use, you can record its URL here. You may add several of them, as several elements. It is for informational purposes only and mainly for the maintenance of the config file, the client currently does not use them at all.</h2> +<h2 class="syntaxbox" id="If_your_URL_contains_ampersands_()_please_remember_to_replace_them_with_HTML_entities_(amp)._For_example">If your URL contains ampersands (<code>&</code>), please remember to replace them with HTML entities (<code>&amp;</code>). For example:</h2> +<h2 id="sect14"> </h2> +<h2 id="<documentation_urlhttpexample.comhelp.phpclientthunderbirdamplangen>"><<span class="start-tag">documentation</span><span class="attribute-name"> url</span>="http://example.com/help.php?client=thunderbird<span style="color: #b22222;"><strong>&amp;</strong></span>lang=en"/></h2> +<h2 class="syntaxbox" id="Otherwise_your_XML_file_will_be_incorrect_and_Thunderbird_will_neither_be_able_to_parse_it_nor_to_return_any_error_message.">Otherwise your XML file will be incorrect and Thunderbird will neither be able to parse it, nor to return any error message.</h2> diff --git a/files/zh-tw/mozilla/thunderbird/autoconfiguration/fileformat/index.html b/files/zh-tw/mozilla/thunderbird/autoconfiguration/fileformat/index.html new file mode 100644 index 0000000000..76a90f2777 --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/autoconfiguration/fileformat/index.html @@ -0,0 +1,10 @@ +--- +title: Autoconfig file format +slug: Mozilla/Thunderbird/Autoconfiguration/FileFormat +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Thunderbird/Autoconfiguration/FileFormat +--- +<ul> <li><a href="/en/Thunderbird/Autoconfiguration/FileFormat/HowTo" title="en/Thunderbird/Autoconfiguration/FileFormat/HowTo">How to create a config file</a></li> <li><a href="/en/Thunderbird/Autoconfiguration/FileFormat/Definition" title="en/Thunderbird/Autoconfiguration/FileFormat/Definition">File format definition</a></li> +</ul> diff --git a/files/zh-tw/mozilla/thunderbird/autoconfiguration/index.html b/files/zh-tw/mozilla/thunderbird/autoconfiguration/index.html new file mode 100644 index 0000000000..84cc17039c --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/autoconfiguration/index.html @@ -0,0 +1,113 @@ +--- +title: Autoconfiguration in Thunderbird +slug: Mozilla/Thunderbird/Autoconfiguration +tags: + - Administration + - NeedsTranslation + - TopicStub + - enterprise +translation_of: Mozilla/Thunderbird/Autoconfiguration +--- +<p>Author: Ben Bucksch<br> + Please do not change this document without consulting the author</p> +<p>Thunderbird 3.1 and later (and 3.0 to some degree) includes mail account autoconfiguration functionality. The goal of autoconfiguration is to make it very easy for users to configure the connection of Thunderbird to their email servers. In many cases, people should be able to download and install Thunderbird, enter their real name, email address and password in the Account Setup Wizard and have a fully functioning mail client and get and send their mail as securely as possible.</p> +<p>See also:</p> +<ul> + <li>the <a class="link-https" href="https://wiki.mozilla.org/Thunderbird:Autoconfiguration" title="https://wiki.mozilla.org/Thunderbird:Autoconfiguration">project page on the Mozilla wiki</a> for background, design, implementation and project details</li> + <li>for instructions for users, see <a class="external" href="http://support.mozillamessaging.com/en-US/kb/Automatic+Account+Configuration" title="http://support.mozillamessaging.com/en-US/kb/Automatic+Account+Configuration">Automatic Account Configuration</a> on the Thunderbird Knowledge Base.</li> + <li>the configuration file <a href="/en/Thunderbird/Autoconfiguration/FileFormat/HowTo" title="en/Thunderbird/Autoconfiguration/FileFormat/HowTo">description</a> and <a href="/en/Thunderbird/Autoconfiguration/FileFormat/Definition" title="en/Thunderbird/Autoconfiguration/FileFormat/Definition">definition</a></li> +</ul> +<p>This document describes how Autoconfiguration in Thunderbird works, and what to do to allow mail servers to be autoconfigured.</p> +<h1 id="Mechanisms">Mechanisms</h1> +<p>Thunderbird gets the server settings via different means, each of which is intended for different cases:</p> +<ul> + <li>ISPDB<br> + The ISPDB is a central database, currently hosted by Mozilla Messaging, but free to use for any client. It contains settings for the world's largest ISPs. We hope that the database will soon have enough information to autoconfigure approximately 50% of our user's email accounts.<br> + It was added merely because we cannot assume that all big ISPs (including Microsoft) will immediately set up a configuration server for Thunderbird.</li> + <li>Configuration server at ISP<br> + ISPs have the option to provide their configuration information themselves directly to users, by setting up a web server at autoconfig.<domain>, which simply returns a static XML file with the configuration, as described below. For more complicated setups, for example when the login name does not appear in the the email address, the XML file can also be generated by the ISP. In such complicated cases, this is the only way to allow an automatic setup.</li> + <li>Configuration file on harddisk<br> + Administrators may place a configuration file in the Thunderbird installation folder. This is mainly intended for companies who install Thunderbird on their employees' computers and want to enable easy account setup without having to set up a configuration server. This method is not practical for other use cases, because it is difficult to update the configuration file. Therefore, public ISPs should use a configuration server.</li> + <li>Guessing<br> + If all other mechanisms failed, Thunderbird tries to guess the configuration, by trying common server names like imap.<domain>, smtp.<domain>, mail.<domain> etc., and, when a mail server answers, checking whether it supports SSL, STARTTLS and encrypted passwords (CRAM-MD5).</li> + <li>Manual configuration<br> + If guessing fails the user must manually enter the configuration information. Users can may also manually modify the account settings even if configuration information is successfully obtained by the methods described above.</li> +</ul> +<p>All the lookup mechanisms use the email address domain as base for the lookup. For example, for the email address <a class="moz-txt-link-abbreviated link-mailto" href="mailto:fred@example.com">fred@example.com</a> , the lookup is performed as (in this order):</p> +<ol> + <li><em>tb-install-dir</em>/isp/example.com.xml on the harddisk</li> + <li>check for autoconfig.example.com</li> + <li>look up of "example.com" in the ISPDB</li> + <li>look up "MX example.com" in DNS, and for mx1.mail.hoster.com, look up "hoster.com" in the ISPDB</li> + <li>try to guess (imap.example.com, smtp.example.com etc.)</li> +</ol> +<p>We may in the future add DNS SRV records as supported mechanism in the future, but we currently do not.</p> +<h1 id="How_to_add_support_for_your_domain">How to add support for your domain</h1> +<h2 id="Classification">Classification</h2> +<p>If you are a big ISP (> 100,000 users) providing email addresses solely under a few domains like "example.com" and "example.de", you may either submit the configuration to the ISPDB or set up a configuration server.<br> + <br> + If you support email aliases and the user's login name is not part of the email address (for example, users may have <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:hero@example.com">"hero@example.com"</a> as email address, but the IMAP/POP/SMTP login name is neither "hero" nor <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:hero@example.com">"hero@example.com"</a>, but "u67578"), you need to set up a configuration server, which does the email address -> login name lookup.<br> + <br> + If you host customer domains, i.e. you are "hoster.com", but your customers have <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:fred@flintstone.com">"fred@flintstone.com"</a> and <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:louis@kent.com">"louis@kent.com"</a> as domains, with only a few users per domain, you need to set up a configuration server (or rely on DNS MX).<br> + <br> + If you are a small company installing Thunderbird on your employees' desktops, you can place a configuration file in the Thunderbird installation folder.</p> +<h2 id="ISPDB">ISPDB</h2> +<p>Database URL is <a class="moz-txt-link-rfc2396E link-https" href="https://live.mozillamessaging.com/autoconfig/v1.1/" title="https://live.mozillamessaging.com/autoconfig/v1.1/"><https://live.mozillamessaging.com/autoconfig/v1.1/></a>, append domain name, e.g. <a class="moz-txt-link-rfc2396E link-https" href="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de" title="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de"><https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de></a>.<br> + <br> + Current process: File a bug in <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Webtools&component=ISPDB%20Database%20Entries&op_sys=All&rep_platform=All">Bugzilla</a>, Product "Webtools", Component "ISPDB Database Entries", with a configuration file that matches the requirements described below. Request review from bwinton, gozer or ben.bucksch.<br> + <br> + Future: add the configuration to the <a class="link-https" href="https://ispdb.mozillamessaging.com">ISPDB server app</a>.</p> +<h2 id="Configuration_server_at_ISP">Configuration server at ISP</h2> +<p>Given the email address <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:fred@example.com">"fred@example.com"</a>, Thunderbird first checks <<span class="external free"><a class="moz-txt-link-freetext external" href="http://autoconfig.example.com/mail/config-v1.xml?emailaddress=fred@example.com">http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=fred@example.com</a></span>> and then <a class="moz-txt-link-rfc2396E external" href="http://example.com/.well-known/autoconfig/mail/config-v1.1.xml" title="http://example.com/.well-known/autoconfig/mail/config-v1.1.xml"><http://example.com/.well-known/autoconfig/mail/config-v1.1.xml></a>.</p> +<h3 id="Small_company">Small company</h3> +<p>If you are a small company, you can put the XML configuration file on your web server, at URL <a class="moz-txt-link-rfc2396E external" href="http://example.com/.well-known/autoconfig/mail/config-v1.1.xml"><http://example.com/.well-known/autoconfig/mail/config-v1.1.xml></a>. (This is not yet finalized and subject to change.)</p> +<h3 id="Domain_hoster">Domain hoster</h3> +<p>If you are an ISP that hosts domains for your customers - for example, you are hoster.com and your customer registers fancy.com or example.com, and your servers accept and serve the mail for example.com -, you should set up an autoconfig server.</p> +<h4 id="DNS">DNS</h4> +<p>For each customer domain, you add a DNS record (in addition to the existing MX, A www etc. DNS records):<br> + <code>autoconfig IN A 10.2.3.4</code><br> + or<br> + <code>autoconfig IN CNAME autoconfig.hoster.com</code>.<br> + ... where 10.2.3.4 and autoconfig.hoster.com are IP addresses / hostnames you own.<br> + This allows Thunderbird to find you as hoster.</p> +<p>To make the Version without an autoconfig DNS Entry work you have to make sure that example.com points to the Webserver you will place the config-v1.1.xml on.</p> +<p>Example: <span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">example.com A 10.2.3.4</span></p> +<h4 id="Web_server">Web server</h4> +<p>You set up a web server bound to a physical IP address. This may be on the same machine as other web servers, but the web server must be configured to the content to any requested domain.<br> + <br> + You must use an virtual host that match all autoconfig.* domains of your customers. In Apache terms, you can use a "ip-based virtual host". In the Apache configuration files, that means something like: Listen 10.2.3.4:80 (of course, you use a public IP address that you own)</p> +<pre><VirtualHost 10.2.3.4:80> #Must be the first and only virtual host with this ip! + DocumentRoot /var/www/autoconfig/ + ServerName autoconfig.hoster.com + <Directory /var/www/autoconfig> + Order allow,deny + allow from all + </Directory> +</VirtualHost></pre> +<p>Place the configuration file at the URL /mail/config-v1.1.xml on that host.</p> +<p>All config files must be served as <code>Content-Type: text/xml</code> (or <code>application/xml</code>), otherwise the file will be ignored. Also, they must use charset UTF-8 (esp. if there are any non-ASCII-characters).</p> +<p>If you like to use name-based virtual hosts. You probably don't want to setup the autoconfig subdomain for every domain of your customers.<br> + You can add a Rewriterule in the default virtual host (on debian /etc/apache2/sites-enabled/000-default) to match all autoconfig.* subdomains:</p> +<pre><VirtualHost *:80> #Must be the first Virtual host + ServerAdmin webmaster@hoster.com + ServerName www + DocumentRoot /var/www + RewriteEngine On + RewriteCond %{HTTP_HOST} ^autoconfig\. [NC] + RewriteRule ^/(.*) http://autoconfig.hoster.com/$1 [L,R=301,NE] + #... +</VirtualHost> +<VirtualHost *:80> + DocumentRoot /var/www/autoconfig/ + ServerName autoconfig.hoster.com + <Directory /var/www/autoconfig> + Order allow,deny + allow from all + </Directory> +</VirtualHost> +</pre> +<p> </p> +<p> </p> +<h2 id="Configuration_file">Configuration file</h2> +<p>This is described at <a href="/en/Thunderbird/Autoconfiguration/FileFormat/HowTo" title="en/Thunderbird/Autoconfiguration/FileFormat/HowTo">How to create a configuration file</a> and <a href="/en/Thunderbird/Autoconfiguration/FileFormat/Definition" title="en/Thunderbird/Autoconfiguration/FileFormat/Definition">defined</a> on the sub-pages.</p> +<p>{{ languages( { "ja": "ja/Thunderbird/Autoconfiguration" } ) }}</p> diff --git a/files/zh-tw/mozilla/thunderbird/deploying_thunderbird_in_the_enterprise/index.html b/files/zh-tw/mozilla/thunderbird/deploying_thunderbird_in_the_enterprise/index.html new file mode 100644 index 0000000000..0873a7d1f2 --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/deploying_thunderbird_in_the_enterprise/index.html @@ -0,0 +1,26 @@ +--- +title: Deploying Thunderbird in the Enterprise +slug: Mozilla/Thunderbird/Deploying_Thunderbird_in_the_Enterprise +tags: + - Corporate + - Corporation + - NeedsTranslation + - Thunderbird 3 + - TopicStub + - enterprise + - thunderbird +translation_of: Mozilla/Thunderbird/Deploying_Thunderbird_in_the_Enterprise +--- +<p>These documents and references are provided to help those involved in deploying Thunderbird in large institutions. </p> +<p>The documents are maintained primarily by volunteers and are a work in progress. In other words, there are improvements and additions still be made, <strong>and you can help make those changes</strong>. If you have skills, experience or information that will make these items better in small ways or large, please edit the documents directly, after <a href="/en-US/docs/Project:MDN/Contributing/Join_the_community#Create_an_MDN_account">creating an MDN account</a> or registering with <a class="link-https" href="https://wiki.mozilla.org/Thunderbird/Enterprise" title="https://wiki.mozilla.org/Thunderbird/Enterprise">mozilla wiki</a> if you don't already have an account. You may also comment on the Talk page to note items that may be missing or inaccurate.</p> +<p><strong>References</strong></p> +<ul> + <li><a href="/en/Thunderbird/Deploying_Thunderbird_in_the_Enterprise/Upgrading_Thunderbird_in_the_Enterprise" title="en/Thunderbird/Deploying Thunderbird in the Enterprise/Upgrading Thunderbird in the Enterprise">Upgrading Thunderbird in the Enterprise</a></li> + <li><a href="/en/Thunderbird/Deploying_Thunderbird_in_the_Enterprise/Thunderbird_Preferences_Relevant_to_Enterprises" title="en/Thunderbird/Deploying Thunderbird in the Enterprise/Thunderbird Preferences Relevant to Enterprises">Thunderbird Preferences Relevant to Enterprises</a></li> + <li><a href="/en/Thunderbird/Thunderbird_Enterprise_Tips" title="en/Thunderbird/Thunderbird_Enterprise_Tips">Thunderbird Enterprise Tips</a></li> +</ul> +<p><strong>Related information</strong></p> +<ul> + <li><a class="link-https" href="https://wiki.mozilla.org/Thunderbird/Enterprise" title="https://wiki.mozilla.org/Thunderbird/Enterprise">Enterprise community, deployment, articles and help documents, and news wiki</a></li> +</ul> +<p>{{ languages( { "ja": "ja/Thunderbird/Deploying_Thunderbird_in_the_Enterprise" } ) }}</p> diff --git a/files/zh-tw/mozilla/thunderbird/deploying_thunderbird_in_the_enterprise/upgrading_thunderbird_in_the_enterprise/index.html b/files/zh-tw/mozilla/thunderbird/deploying_thunderbird_in_the_enterprise/upgrading_thunderbird_in_the_enterprise/index.html new file mode 100644 index 0000000000..b067ae50fd --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/deploying_thunderbird_in_the_enterprise/upgrading_thunderbird_in_the_enterprise/index.html @@ -0,0 +1,260 @@ +--- +title: 於企業內升級 Thunderbird +slug: >- + Mozilla/Thunderbird/Deploying_Thunderbird_in_the_Enterprise/Upgrading_Thunderbird_in_the_Enterprise +translation_of: >- + Mozilla/Thunderbird/Deploying_Thunderbird_in_the_Enterprise/Upgrading_Thunderbird_in_the_Enterprise +--- +<div>{{ draft }}</div> + +<p>這是一篇關於幫助大型組織使用 Thunderbird 升級到 3 版的升級手冊 (也可稱之為 "企業")。 這份初步草稿是從草稿作者知識庫摘要 auto-sync / offline settings (<a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562589" rel="nofollow" title="Bug 562589 -- RESOLVED FIXED -- Thunderbird/Migration -- If I disable migration wizard I'm in situation where all IMAP -folders are set to download no matter what I do to account in question (Needs a way to keep offline-use setting upon migration to Tb 3, even if Migration Assistant is disabled on purpose)">bug 562589</a>) 與 Thunderbird 3 與管理者相關的搬遷問題 (<a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562589#c7" rel="nofollow" title="timo.pietila@helsinki.fi -- I have to say that IMO you are breaking one of the very fundamental features of IMAP by forcing offline download to get benefit of _VERY MINOR_ email client function. Gloda is mino ...">bug 562589#c7</a>) (如同 2010/05/06).</p> + +<h2 id="背景">背景</h2> + +<p>此份搬遷手冊針對典型的企業環境做出一些假設:</p> + +<ul> + <li>IMAP 帳戶與目錄。</li> + <li>大型郵件檔。</li> + <li>"漫遊配置檔" 或某些接近於共用 (以支援備份/復原與行動用戶)。</li> +</ul> + +<p>(The above requirements may not be compatible with the fact that the new global search (Gloda) is enabled by default on upgrade and IMAP folder automatic synchronization is enabled by default on upgrade. This is discussed further below.)</p> + +<p>企業環境通常需要執行大規模軟件升級,而不是為個人用戶升級軟件,此升級目標也許會是:</p> + +<ul> + <li>解決早期版本已存在的錯誤。</li> + <li>為了改善穩定性與可靠性。</li> + <li>為了改善效能。</li> + <li>為了改善可用性。</li> + <li>盡可能減少或者使用戶用戶培訓簡易。</li> + <li>盡可能減少對於新軟體與更新後的軟體,人員所需要的人力支援。</li> +</ul> + +<p>相關資訊:</p> + +<ul> + <li><a href="/en-US/docs/Thunderbird/Deploying_Thunderbird_in_the_Enterprise/Thunderbird_Preferences_Relevant_to_Enterprises">Thunderbird Preferences Relevant to Enterprises</a></li> + <li><a href="/en-US/docs/Thunderbird/Deploying_Thunderbird_in_the_Enterprise" title="Thunderbird/Deploying Thunderbird in the Enterprise">Other resources: Forums, How Tos, ....</a></li> +</ul> + +<h2 id="遷移指南_(Thunderbird_2_升級到_Thunderbird_3.0)"><span class="mw-headline">遷移指南 (Thunderbird 2 升級到 Thunderbird 3.0) </span></h2> + +<p>The major changes in Thunderbird 3.0 that are relevant to enterprise administrators include:</p> + +<ul> + <li>Gloda (Global Search and Indexer). Enabled by default.</li> + <li>Auto-sync of IMAP folders. Enabled by default.</li> + <li>Per-folder "offline use" setting of all IMAP folders is changed to "offline use=On" by default upon migration.</li> + <li>"Smart Folders" is default folder pane view, even if "All Folders" is user's choice in Thunderbird 2.</li> +</ul> + +<p>For more detailed information about the changes between Thunderbird 2 and Thunderbird 3, see:</p> + +<ul> + <li><a class="external text" href="http://www.mozillamessaging.com/en-US/thunderbird/3.0/releasenotes/" rel="nofollow" title="http://www.mozillamessaging.com/en-US/thunderbird/3.0/releasenotes/">Thunderbird Release Notes</a></li> + <li><a class="external text" href="/en-US/docs/Thunderbird_3_for_users" rel="nofollow" title="https://developer.mozilla.org/en/Thunderbird_3_for_users">Thunderbird 3 for users</a></li> + <li><a class="external text" href="/en-US/docs/Thunderbird_3_for_developers" rel="nofollow" title="https://developer.mozilla.org/En/Thunderbird_3_for_developers">Thunderbird 3 for developers</a></li> +</ul> + +<p>As a general rule, administrators should deal with the process of upgrading Thunderbird and enabling new features separately. That is, they should try to keep the user setup as similar as possible between Thunderbird 2 and 3 and wait until the Thunderbird 3 upgrade is complete and stable before enabling Thunderbird 3 features.</p> + +<h3 id="在遷移前,停用附加元件以進行安全升級"><span class="mw-headline">在遷移前,停用附加元件以進行安全升級</span></h3> + +<p>Problems due to add-on are known. For example;</p> + +<ul> + <li><a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=533692" rel="nofollow" title="Bug 533692 -- RESOLVED FIXED -- Thunderbird/General -- Kaspersky Anti-Spam Extension causes blank main window on 2.0.0.23 to 3.0 upgrade">Bug 562589</a> Kaspersky Anti-Spam Extension causes blank main window on 2.0.0.23 to 3.0 upgrade</li> + <li><a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=543076" rel="nofollow" title='Bug 543076 -- RESOLVED INVALID -- MailNews Core/Networking: IMAP -- TB 3.0.1 does not handle IMAP Attachments correctly (bug of "Attachment size" add-on or some others)'>Bug 543076</a> TB 3.0.1 does not handle IMAP Attachments correctly (bug of "Attachment size" add-on or some others)</li> +</ul> + +<p>To avoid such unwanted problems due to add-ons, next upgrade procedure is recommended for safe migration.</p> + +<ol> + <li>Start Tb 2 with -safe-mode to make all add-ons disabled before upgrade.</li> + <li>Keep backup of profile directory before upgrade.</li> + <li>If possible, do uninstall of Thunderbird 2 and clean install of Thunderbird 3, instead of upgrade by software update by Thunderbird 2, for both safe migration and reducing of network traffic.</li> +</ol> + +<h3 id="停用遷移幫手"><span class="mw-headline">停用遷移幫手</span></h3> + +<p>Enterprise sites that perform mass upgrades generally want to prevent users from performing Thunderbird upgrades on their own. An upgrade dialogue in the Thunderbird Migration Assistant should be disabled.</p> + +<pre>lockPref("mail.ui.show.migration.on.upgrade",false);</pre> + +<h3 id="停用全域_(全域搜索與索引)_以避免遷移後的索引"><span class="mw-headline">停用全域 (全域搜索與索引) 以避免遷移後的索引</span></h3> + +<p>Initail purpose of Gloda was solution of of problem like <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=383895" rel="nofollow" title='Bug 383895 -- NEW -- Thunderbird/Search -- Thunderbird Message Body/fulltext search or filter is painfully slow compared to Outlook on folders with lots of messages (both "quick search" and "search messages")'>Bug 383895</a> (slowness in body text search of local mail data). With enhancements and many improvements by Thuderbird 3 on auto-sync of IMAP folder, Gloda can be used also for IMAP folders very easily. So, gloda is very useful for everyday usage even for IMAP users: It can search messages very fast, much faster than an IMAP server can, and so notably increase productivity. Also, it will in the future have increased functionality in other areas.</p> + +<p>However, the new Thunderbird 3 search and index functionality initially impacts performance. (The indexer runs when Thunderbird 3 is first started and will continue to work until all the user's email is indexed. The more messages a user has, the longer the indexer will run.) Also, it uses diskspace on the client (about 1/2 (?) of mailbox size), which is a problem for roaming profiles.</p> + +<p>Gloda can be enabled by only single action after upgrade - check an option at Tools/Options/Advanced/General tab. So, to minimize user support workload after migration, we recommend you to disable automatic enabling of Gloda durng migration by Thunderbird 3.</p> + +<blockquote>怎麼會? 可能嗎? 需要加強?</blockquote> + +<h3 id="停用自動同步,保持每個資料夾_離線使用_設定,以避免遷移後每個巨大的_IMAP_資料夾下載所有郵件"><span class="mw-headline">停用自動同步,保持每個資料夾 "離線使用" 設定,以避免遷移後每個巨大的 IMAP 資料夾下載所有郵件</span></h3> + +<p>Auto-sync of IMAP folders is enabled by default for all IMAP accounts. The per folder "offline use" setting of all IMAP folders is changed to "offline use=On" when Thunderbird 3 is launched the first time. To keep same settings as Thunderbird 2, disable the auto-sync and offline-use settings upon upgrade.</p> + +<p>完全停用自動同步 (auto-sync):</p> + +<pre>lockPref("mail.server.default.autosync_offline_stores", false); +lockPref("mail.server." + serverFromAccount + ".autosync_offline_stores", false); +</pre> + +<p>停用每個資料夾 "離線使用 (offline use)" 設定在遷移時設定變更 (Tb 3.0.5 到 Tb 3.1rc1):</p> + +<pre>lockPref("mail.server." + serverFromAccount + ".offline_download", false); +</pre> + +<p>To disable per folder "offline use" setting change upon migration (Tb 3.1rc2 or later):</p> + +<pre>lockPref("mailnews.ui.show.migration.on.upgrade",false); +</pre> + +<p>注意:</p> + +<ul> + <li>mail.server.serverX.offline_download (default=true) of Tb 3. + <ul> + <li>When an IMAP folder is created or subscribed, set offline use=off if false, set offline use=on if true.<br> + i.e. This setting is for default of offline use=on/off of an IMAP folder.</li> + </ul> + </li> + <li>Enhancement of mail.server.serverX.offline_download=flase prior to upgrade to Tb 3(from Tb 3.0.5 to Tb 3.1rc1). + <ul> + <li>Upon first use of Tb 3, if mail.server.serverX.offline_download=false is set before upgrade, IMAP folder's "offline use" is not touched by Migration code of Tb 3 .</li> + <li>It's enhanced by <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562589" rel="nofollow" title="Bug 562589 -- RESOLVED FIXED -- Thunderbird/Migration -- If I disable migration wizard I'm in situation where all IMAP -folders are set to download no matter what I do to account in question (Needs a way to keep offline-use setting upon migration to Tb 3, even if Migration Assistant is disabled on purpose)">bug 562589</a>. This enhancement is already landed on Tb3.1pre and Tb3.2pre, and the enhancement has been landed on Tb 3.0.5pre(As of 2010/5/10).</li> + </ul> + </li> + <li>Above enhancement of mail.server.serverX.offline_download=false prior to migration of bug 562589 has been removed by Bug 569161. + <ul> + <li>Code which changes offline-use=on/off of IMAP folders upon migration is moved to Migration Assistant by <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=569161" rel="nofollow" title="Bug 569161 -- VERIFIED FIXED -- Thunderbird/Migration -- New Migration Assistant does not honor Advanced IMAP Synchronization settings">bug 569161</a>. So, if Migration Assistant is disabled, offline-use setting of any IMAP folder is never touched upon migration to Tb 3.1 and Tb 3.2.</li> + <li>Patch of bug 569161 is landed on Tb3.1rc2 and Tb3.2a1(As of 2010/06/07).</li> + </ul> + </li> +</ul> + +<h4 id="在遷移後,如何啟用自動同步">在遷移後,如何啟用自動同步</h4> + +<p>Account Settings/Synchronization & Disk Space</p> + +<ul> + <li>[ ? ] Keep messages of this account on this computer</li> +</ul> + +<p>Current behavior of UI for auto-sync setting.</p> + +<ul> + <li>Unchecked->Checked + <ol> + <li>Set mail.server.serverX.offline_download=true</li> + <li>Set offline use=on of all folders of the IMAP account</li> + <li>Enable "Advanced" button to change offline-use setting of IMAP folders</li> + </ol> + </li> + <li>Checked->Unchecked + <ol> + <li>Set mail.server.serverX.offline_download=false</li> + <li>Set offline use=off of all folders of the IMAP account</li> + <li>Disable "Advanced" button to change offline-use setting of IMAP folders</li> + </ol> + </li> +</ul> + +<p>Note: There is a request for a design change in <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=537943" rel="nofollow" title='Bug 537943 -- NEW -- Thunderbird/Folder and Message Lists -- "Advanced" button at Synchronization&amp;Disk Space should be enabled even if mail.server.serverX.offline_download=false is set, and is better to be called "Folder Property Manager".'>bug 537943</a>.</p> + +<p>Gloda and auto-sync/offline-use are possibly independent, although relevant.</p> + +<ul> + <li>"Download Now" button downloads mail to offline-use regardless of offline-use=On/Off.</li> + <li>"Download Now" button seems to be intercepted and discarded if auto-sync is enabled and offline-use=On. It looks due to already started schedule based automatic downloading.</li> + <li>Auto-sync automatically downloads mail data to offline-store if auto-sync is enabled and if offline-use=On is set in an IMAP folder.</li> + <li>"Work Offline" automatcally downloads mail data to offline-store automatically, if per folder offline-use=On is set in an IMAP folder.</li> + <li>Gloda indexes mail data in offline-store, if mail data is saved in offline-store, perhaps regardless of auto-sync is enabled/disabled and offline-use=On/Off and Working Online/Working Offline.</li> +</ul> + +<h3 id="修改資料夾面板檢視從_聰明資料夾_為_所有資料夾"><span class="mw-headline">修改資料夾面板檢視從 "聰明資料夾 " 為 "所有資料夾" </span></h3> + +<p>By default, Thunderbird 3 displays "Smart Folders" in the folder pane. (Smart Folders combine the messages in similarly named folders in multiple accounts, for example grouping Inbox messages from all accounts into a single Inbox on the Smart Folder pane.) If you want to preserve the default Thunderbird 2 behavior of showing "All Folders", advice users to select <strong>View | Folders | All</strong> from the menu.</p> + +<p>Can "forcing Smart Folders view" upon migration be stopped? How? Is it possible? Enhancement is needed?</p> + +<p>Note: "Smart Folders" is renamed to "Unified Folders" by Tb 3.1, and Tb 3.1 won't force it upon migration from Tb2 any more.</p> + +<h2 id="注意事項">注意事項</h2> + +<h3 id="由自動配置_(autoconfig)_帳戶定義"><span class="mw-headline">由自動配置 (autoconfig) 帳戶定義</span></h3> + +<p>When new accounts are created, the new "autoconfig" functionality is automatically invoked. Unless users have the correct account definition parameters, it may be confusing for them to configure their own accounts (if this is permitted).</p> + +<h3 id="IMAP_資料夾檔案的位置"><span class="mw-headline">IMAP 資料夾檔案的位置</span></h3> + +<p>By default, the IMAP folder file is located in each user's profile directory. If the user is storing a lot of messages for off-line access, this can result in too much data for a roaming profile. Regardless of whether or not there is a roaming profile, there may be if the profile is located on a network resource or if Microsoft Window's Offline File (CSC) is used for the offline storage file.</p> + +<p>If that is the case, you have two options:</p> + +<p>If the Gloda search and index is mandatory for IMAP mail data:</p> + +<ol> + <li>Locate mail directory for IMAP account at location with which remote/network access won't happen(e.g. "Local Settings" of MS Win)</li> + <li>Enable auto-sync, and set offline use=on of IMAP folders.</li> + <li>Accept download of all mails to any PC which uses the IMAP account.</li> + <li>Accept per PC thread pane column setting of the IMAP accout. + <ul> + <li> + <dl> + <dt> </dt> + </dl> + + <dl> + <dd>As thread pane column setting is currently saved in .msf file, and as you selected folder location other than profile directory, data in .msf can not be shared among PCs, even when you use Roaming Profile.</dd> + </dl> + </li> + </ul> + </li> +</ol> + +<p>When Gloda is not needed for IMAP mail data:</p> + +<ol> + <li>Locate IMAP folder file at any place you want.</li> + <li>Disable auto-sync, and/or set offline use=off of all IMAP folders. + <ul> + <li> + <dl> + <dt> </dt> + </dl> + + <dl> + <dd>As new feature of "Disk Cache for mail in IMAP folder of offline-use=off" is added to Tb 3, mail data of viewed mail is held in far larger Disk Cache than very small memory cache of Thunderbird 2. So, frequency of problem like "repeatedly downloaded big attachment data" is reduced very much compared to Thunderbird 2.</dd> + </dl> + </li> + </ul> + </li> +</ol> + +<p>As Gloda is first solution of problem of <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=383895" rel="nofollow" title='Bug 383895 -- NEW -- Thunderbird/Search -- Thunderbird Message Body/fulltext search or filter is painfully slow compared to Outlook on folders with lots of messages (both "quick search" and "search messages")'>Bug 383895</a> (slowness in body text search of local mail data), and as many IMAP servers have excellent body text search functionality, consider utilizing of online search first for IMAP mail data. If online search is usable, enabling of auto-sync/offline-use merely for Gloda can be avoided.</p> + +<h3 id="線上搜尋_IMAP_資料夾"><span class="mw-headline">線上搜尋 IMAP 資料夾</span></h3> + +<p>There is known with regards to online search (documented in <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=546925" rel="nofollow" title="Bug 546925 -- NEW -- Thunderbird/Search -- custom header search is non-functional ('Run search on server' of Edit/Find/Search Messages doesn't work any more)">Bug 546925</a> "Run search on server" of Edit/Find/Search Messages doesn't work). For now, users must use Quick Search or Virtual Folder (Saved Search folder) for online searches.</p> + +<h3 id="搜尋、自動同步、離線使用與_聰明資料夾"><span class="mw-headline">搜尋、自動同步、離線使用與 "聰明資料夾" </span></h3> + +<p>If IMAP folder of offline-use=off, full text search by Gloda won't work because of offline-use=off.</p> + +<p>And, if not all mails of IMAP folder of offline-use=on is downloaded into local offline-store file because of your setting for offline-store file size limitation, Gloda can't find not-downloaded mails of the IMAP folder.</p> + +<p>And, as "Smart Folder" is internally Virtual Folder(Saved Search Folder), a "Smart Folder" can be Virtual Folder with multiple search target folders in mixture of local mail folders, IMAP folders of offline-use=on(all mails are sync'ed), IMAP folders of offline-use=on(not all mails are sync'ed), and IMAP folders of offline-use=off.</p> + +<p>Never open bug at bugzilla.mozilla.org for "Search can't find my mail!" without sufficient checking of "what mail at what kind of folder is not hit by what kind of search at where", please.</p> + +<h2 id="遷移手冊_(Thunderbird_2_到_Thunderbird_3.1)"><span class="mw-headline">遷移手冊 (Thunderbird 2 到 Thunderbird 3.1) </span></h2> + +<p>(content needed)</p> + +<h2 id="遷移手冊_(Thunderbird_3.0_到_Thunderbird_3.1)"><span class="mw-headline">遷移手冊 (Thunderbird 3.0 到 Thunderbird 3.1) </span></h2> + +<p>(content needed)</p> diff --git a/files/zh-tw/mozilla/thunderbird/index.html b/files/zh-tw/mozilla/thunderbird/index.html new file mode 100644 index 0000000000..f0a48a2be0 --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/index.html @@ -0,0 +1,79 @@ +--- +title: Thunderbird +slug: Mozilla/Thunderbird +tags: + - NeedsTranslation + - TopicStub + - thunderbird +translation_of: Mozilla/Thunderbird +--- +<p><strong>Thunderbird</strong> is Mozilla's mail/messaging application. These pages document Thunderbird and also provide links to documentation about the <a href="/en-US/docs/tag/MailNews" title="tag/MailNews">MailNews</a> backend which is also used in other projects such as <a href="http://wiki.mozilla.org/Penelope">Eudora/Penelope</a>, <a href="http://www.seamonkey-project.org/">Seamonkey</a>, <a href="http://nkreeger.com/correo/">Correo</a>, etc.</p> +<p>Thunderbird is Firefox's kid sibling, and is built on the same technical platform as the web browser. In development for many years, and currently one of the most popular open source email clients, it is used by millions of people around the world to bring together all their email accounts, newsgroup and feed reading in a familiar high-productivity environment. (From early 2007 to early 2011 Thunderbird was developed by <a class="link-https" href="https://en.wikipedia.org/wiki/Mozilla_Messaging" title="https://en.wikipedia.org/wiki/Mozilla_Messaging">Mozilla Messaging</a>, a subsidiary that was owned by Mozilla.)</p> +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="Documentation" name="Documentation">Documentation</h2> + <dl> + <dt> + <a href="https://developer.mozilla.org/en-US/docs/Simple_Thunderbird_build" title="Simple Thunderbird build">Building Thunderbird</a></dt> + <dd> + Information about building Thunderbird with the <a href="/en-US/docs/comm-central" title="comm-central">comm-central</a> repository. There's also information about <a href="/en-US/docs/How_comm-central%27s_build_system_works" title="How_comm-central's_build_system_works">how comm-central works</a>, how the <a href="/en-US/docs/Mailnews_and_Mail_code_review_requirements" title="Mailnews and Mail code review requirements">review process works</a> and how to use the <a href="/en-US/docs/Using_the_Mozilla_symbol_server" title="Using the Mozilla symbol server">Mozilla symbol server</a> to help with debugging.</dd> + <dt> + <a href="/en-US/docs/MailNews_Protocols" title="MailNews_Protocols">MailNews Protocols</a></dt> + <dd> + Rough documentation about mail protocols..</dd> + <dt> + <a href="/en-US/docs/DB_Views_%28message_lists%29" title="DB_Views_(message_lists)">Database views</a></dt> + <dd> + Backend information about {{ Interface("nsIMsgDBView") }} and related interfaces..</dd> + <dt> + <a href="/en-US/docs/Thunderbird/Thunderbird_API_documentation" title="Thunderbird API documentation">Thunderbird API documentation</a></dt> + <dd> + Thunderbird API documentation</dd> + <dt> + <a href="/en-US/docs/Extensions/Thunderbird" title="Extensions/Thunderbird/">Extension documentation</a></dt> + <dd> + Tutorials and tips for building Thunderbird extensions</dd> + <dt> + <a href="/en-US/docs/Thunderbird/Thunderbird_Automated_Testing" title="Thunderbird Automated Testing">Automated Testing</a></dt> + <dd> + Details of Thunderbird's automated testing facilities</dd> + <dt> + <a href="/en-US/docs/Thunderbird/Thunderbird_in_the_Enterprise" title="Thunderbird in the Enterprise">Thunderbird in the Enterprise</a></dt> + <dd> + Help with deploying Thunderbird in large organizations</dd> + </dl> + <p><span class="alllinks"><a href="/en-US/docs/tag/Thunderbird" title="tag/Thunderbird">View All...</a></span></p> + </td> + <td> + <h2 class="Community" id="Community" name="Community">Community</h2> + <ul> + <li>Support is handled at <a href="http://getsatisfaction.com/mozilla_messaging" title="http://getsatisfaction.com/mozilla_messaging">getsatisfaction</a>.</li> + <li>Extensions questions are frequently discussed on the dev-apps-thunderbird group: {{ DiscussionList("dev-apps-thunderbird", "mozilla.dev.apps.thunderbird") }}</li> + <li>Development discussion happens on the tb-planning mailing list: + <ul> + <li><a class="link-https" href="https://mail.mozilla.org/listinfo/tb-planning" title="https://mail.mozilla.org/listinfo/tb-planning">subscribe</a></li> + <li><a class="link-https" href="https://mail.mozilla.org/pipermail/tb-planning/" title="https://mail.mozilla.org/pipermail/tb-planning/">archives</a></li> + </ul> + </li> + <li><a href="http://forums.mozillazine.org/viewforum.php?f=50">Mozillazine forums</a></li> + <li><a href="http://www.mozillamessaging.com/">Mozilla Messaging web page</a></li> + <li><a class="link-irc" href="irc://irc.mozilla.org/thunderbird">#thunderbird on irc.mozilla.org</a> (for Users)</li> + <li><a class="link-irc" href="irc://irc.mozilla.org/maildev">#maildev on irc.mozilla.org</a> (for Developers)</li> + <li>a list of all <a href="http://wiki.mozilla.org/Thunderbird/CommunicationChannels" title="Thunderbird communication channels">Thunderbird communication channels</a></li> + </ul> + <h2 class="Tools" id="Tools" name="Tools">Tools</h2> + <ul> + <li><a href="http://ted.mielczarek.org/code/mozilla/extensiondev/">Extension developer's extension</a></li> + <li><a href="/en-US/docs/DOM_Inspector" title="DOM_Inspector">DOM Inspector</a></li> + </ul> + <h2 class="Related_Topics" id="Related_Topics" name="Related_Topics">Related Topics</h2> + <ul> + <li><a href="/en-US/docs/Extensions" title="Extensions">Extensions</a></li> + </ul> + </td> + </tr> + </tbody> +</table> +<p> </p> diff --git a/files/zh-tw/mozilla/thunderbird/thunderbird_extensions/index.html b/files/zh-tw/mozilla/thunderbird/thunderbird_extensions/index.html new file mode 100644 index 0000000000..4ce42f41a7 --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/thunderbird_extensions/index.html @@ -0,0 +1,135 @@ +--- +title: Thunderbird extensions +slug: Mozilla/Thunderbird/Thunderbird_extensions +tags: + - Add-ons + - Extensions + - NeedsTranslation + - TopicStub + - thunderbird +translation_of: Mozilla/Thunderbird/Thunderbird_extensions +--- +<div class="callout-box"><strong><a href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension" title="en/Building_a_Thunderbird_extension">Building a Thunderbird extension</a></strong><br> +Step-by-step explanation on how to build an extension for Thunderbird.</div> + +<div> +<p>{{AddonSidebar}}</p> +The following documentation provides help for creating extensions for Mozilla's <a class="internal" href="/en/Thunderbird" title="En/Thunderbird">Thunderbird</a> email client. Although there are many similarities with <a href="/en/Extensions" title="en/Extensions">Firefox extensions</a> there are also some differences that may confound the starting developer.</div> + +<div><br> +<strong>Please help!</strong> You can <a class="internal" href="/en/Extensions/Thunderbird/HowTos" title="en/Extensions/Thunderbird/HowTos">add a how-to</a> (a question or an answer or a code snippet), <a class="internal" href="/en/Extensions/Thunderbird/Useful_newsgroups_discussions" title="En/Extensions/Thunderbird/Useful newsgroups discussions">summarize and link to a relevant newsgroup discussion</a>, or create a tutorial. Need help? Contact <a class="internal" href="/User:jenzed" title="User:jenzed">jenzed</a>.</div> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 id="Documentation" name="Documentation"><a href="/Special:Tags?tag=Extensions&language=en" title="Special:Tags?tag=Extensions&language=en">Documentation</a></h2> + + <h3 id="Getting_started_with_Thunderbird">Getting started with Thunderbird</h3> + + <p>A brave, young developer wants to develop an add-on for Thunderbird. Here's a few links to help them through this journey.</p> + + <ul> + <li>Start by reading the tutorial and learn how to<a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension" title="En/Building a Thunderbird extension"> build a Thunderbird extension</a> (Outdated, still talks about overlays and the add-on builder is no longer available but the tutorial has not been updated.)</li> + <li>Read about the <a href="/en/Thunderbird/Main_Windows" title="Main Windows">main windows</a> so that you know what one means when they say « thread pane », « preview pane », and « folder pane ».</li> + + <li>Want to do some real stuff? See <a class="external" href="http://blog.xulforum.org/index.php?post/2011/03/14/Basic-MimeMessage-demo" title="http://blog.xulforum.org/index.php?post/2011/03/14/Basic-MimeMessage-demo">how to inspect a message</a> (demo add-on included!)</li> + <li>Play with our other <a href="/en/Extensions/Thunderbird/Demo_Addon" title="Demo Addon">demo add-on</a> that exercises some more advanced Thunderbird-specific features</li> + <li>Want to do even more stuff? Don't reinvent the wheel: steal functions from the <a class="link-https" href="https://github.com/protz/thunderbird-stdlib" title="https://github.com/protz/thunderbird-stdlib">thunderbird-stdlib</a> project (doc <a class="external" href="http://protz.github.com/thunderbird-stdlib/doc/symbols/_global_.html" title="http://protz.github.com/thunderbird-stdlib/doc/symbols/_global_.html">here</a>). Functions for dealing with messages (delete them, archive them, change their tags, etc.) are included.</li> + <li>Haven't found what you're looking for? Read the <a class="internal" href="/en/Extensions/Thunderbird/HowTos" rel="internal" title="en/Extensions/Thunderbird/HowTos">Thunderbird how-tos</a>; they contain a lot of recipes for things extensions want to do.</li> + <li>Still haven't managed to do what you wanted? See the list of all <a class="external" href="http://wiki.mozilla.org/Thunderbird/CommunicationChannels" title="http://wiki.mozilla.org/Thunderbird/CommunicationChannels">Thunderbird communication channels </a>so that you know where to ask when you get stuck :-).</li> + <li>Feeling really brave? Read the source using a <a class="external" href="http://doxygen.db48x.net/comm-central/html/" title="http://doxygen.db48x.net/comm-central/html/">fancy interface</a>; you can often find tests that demonstrate how to do what you're trying to achieve.</li> + </ul> + + <h3 id="The_Gloda_database">The Gloda database</h3> + + <p>Thunderbird has a subsystem called Gloda. Gloda stands for « Global Database », and creates Thunderbird-wide relations between objects. Gloda provides concepts such as Conversations, Messages, Identities, Contacts. All these concepts are related together: a Conversation contains Messages which are linked to Identities (<strong>from</strong> field, <strong>to</strong> field) which are themselves part of a Contact: indeed, a contact has multiple identities.</p> + + <p>Typical use cases for Gloda: find all messages whose subject matches [search term], find all messages from [person], find all messages in the same thread as [a given message], find all messages involving [person], etc. etc.</p> + + <p>Gloda is extremely powerful and is used heavily by add-ons such as <a class="link-https" href="https://addons.mozilla.org/en-US/thunderbird/addon/gmail-conversation-view/" title="https://addons.mozilla.org/en-US/thunderbird/addon/gmail-conversation-view/">Thunderbird Conversations</a>. Learn more about Gloda:</p> + + <ul> + <li>an overview of <a href="/en/Thunderbird/gloda" title="Gloda">Gloda</a></li> + <li>learn how to create <a href="/en/Thunderbird/Creating_a_Gloda_message_query" title="Creating a gloda message query">your first message query</a> and read the <a href="/en/Thunderbird/Gloda_examples" title="Gloda examples">gloda examples</a></li> + <li>learn about the Gloda internals: <a href="/en/Thunderbird/Gloda_debugging" title="Gloda debugging">Gloda debugging</a>, <a href="/en/Thunderbird/Gloda_indexing" title="Gloda indexing">Gloda indexing</a></li> + </ul> + + <h3 id="More_Thunderbird-specific_links">More Thunderbird-specific links</h3> + + <p>Some of these links may be wildly out of date, but they still provide valuable information on the codebase.</p> + + <ul> + <li><a class="internal" href="/en/Extensions/Thunderbird/An_overview_of_the_Thunderbird_interface" title="En/Extensions/Thunderbird/An overview of the Thunderbird interface">An overview of Thunderbird components</a></li> + <li><a class="internal" href="/en/Extensions/Thunderbird/Thunderbird_developer_reference_docs" title="en/Extensions/Thunderbird/Thunderbird developer reference docs">Developer reference docs</a>: + <ul> + <li><a class="internal" href="/en/Folders" title="En/Folders">Folder classes</a></li> + <li><a class="internal" href="/en/DB_Views_(message_lists)" title="En/DB Views (message lists)">DB views (message list)</a></li> + <li><a class="internal" href="/en/Message_Summary_Database" title="En/Message Summary Database">Message summary database</a></li> + <li><a class="internal" href="/en/MailNews_Protocols" title="En/MailNews Protocols">MailNews protocols</a></li> + <li><a class="internal" href="/En/MailNews_Filters" rel="internal" title="En/MailNews Filters">MailNews filters</a></li> + <li><a class="internal" href="/en/Extensions/Thunderbird/Error_reporting_tools" title="en/Extension Library/Extensions/Thunderbird/Error reporting tools">Error reporting tools</a></li> + <li><a href="/en/Toolkit_API/STEEL" title="en/Toolkit API/STEEL">STEEL library</a> (obsolete as of Thunderbird 52, use <a class="link-https" href="https://github.com/protz/thunderbird-stdlib" title="https://github.com/protz/thunderbird-stdlib">https://github.com/protz/thunderbird-stdlib</a>)</li> + <li><a class="external" href="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html" title="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html">Developing new account types</a> <strong>NEW!</strong></li> + </ul> + </li> + <li><a class="internal" href="/en/Extensions/Thunderbird/Useful_newsgroups_discussions" title="En/Extensions/Thunderbird/Useful newsgroups discussions">Useful newsgroup discussions</a> (watch out, anything that's too old should be regarded suspiciously; there's been significant API rewrite over the past years, and most of these techniques are considerably easier now) </li> + <li><a href="/en/Thunderbird/Thunderbird_API_documentation" title="en/Thunderbird/Thunderbird API documentation">Thunderbird API docs</a> (mostly a collection of out-of-date pages, relevance is rather dubious) </li> + <li><a href="/en/Mozilla/Thunderbird/Releases" title="Thunderbird developer release notes">Thunderbird developer release notes</a> - changes in the recent Thunderbird updates affecting add-on developers. <a href="/Thunderbird_5_for_developers" title="Thunderbird 5 for developers">Thunderbird 5 for developers</a> has important information on MsgHdrToMimeMessage which is a central piece of code.</li> + </ul> + + <h3 id="General_links">General links</h3> + + <ul> + <li><a href="/en/Extensions/Thunderbird/Finding_the_code_for_a_feature" title="en/Extensions/Thunderbird/Finding the code for a feature">Finding the code for a feature</a></li> + <li><a class="external" href="http://kb.mozillazine.org/Category:Thunderbird" title="http://kb.mozillazine.org/Category:Thunderbird">Mozillazine articles on Thunderbird</a></li> + <li><a href="/Special:Tags?tag=Thunderbird" title="https://developer.mozilla.org/Special:Tags?tag=Thunderbird">All pages tagged with Thunderbird</a></li> + <li><a href="/Special:Tags?tag=MailNews" title="https://developer.mozilla.org/Special:Tags?tag=MailNews">All pages tagged with MailNews</a></li> + </ul> + </td> + <td> + <h2 id="Community" name="Community">Community</h2> + + <ul> + <li>See the list of all <a class="external" href="http://wiki.mozilla.org/Thunderbird/CommunicationChannels" title="http://wiki.mozilla.org/Thunderbird/CommunicationChannels">Thunderbird communication channels </a>first</li> + <li>Among these are:</li> + </ul> + + <p>{{ DiscussionList("dev-extensions", "mozilla.dev.extensions") }}</p> + + <ul> + <li><a class="link-irc" href="irc://moznet/#extdev">#extdev IRC channel</a> / <a class="link-irc" href="irc://moznet/#maildev">#maildev IRC channel</a></li> + <li><a class="external" href="http://forums.mozillazine.org/viewforum.php?f=19">MozillaZine forum</a></li> + <li><a class="external" href="http://mozdev.org/mailman/listinfo/project_owners">mozdev project owners</a></li> + <li><a href="/en/Extensions/Community" title="en/Extensions/Community">Other community links...</a></li> + </ul> + + <h2 id="Tools" name="Tools">Tools</h2> + + <ul> + <li><a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/6622" rel="external nofollow" title="https://addons.mozilla.org/en-US/firefox/addon/6622">DOM Inspector</a> edit the live DOM (Firefox and Thunderbird)</li> + <li><a class="link-https" href="https://addons.mozilla.org/thunderbird/addon/workspace-for-thunderbird/" title="https://addons.mozilla.org/thunderbird/addon/workspace-for-thunderbird/">Workspace for Thunderbird</a>, allows running code snippets in Thunderbird and inspecting variable structure and content</li> + <li><a class="external" href="http://www.hacksrus.com/~ginda/venkman/" rel="external nofollow" title="http://www.hacksrus.com/~ginda/venkman/">Venkman</a>, a JavaScript debugger (<a class="external" href="http://addons.mozilla.org/en-US/firefox/addon/216" rel="external nofollow" title="http://addons.mozilla.org/en-US/firefox/addon/216">Firefox</a>, <a class="external" href="http://addons.mozilla.org/en-US/thunderbird/addon/216" rel="external nofollow" title="http://addons.mozilla.org/en-US/thunderbird/addon/216">Thunderbird</a>)</li> + <li><a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/7434/" rel="external nofollow" title="https://addons.mozilla.org/en-US/firefox/addon/7434/">Extension Developer's Extension</a> a suite of development tools</li> + <li><a class="external" href="http://www.gijsk.com/" rel="external nofollow" title="http://www.gijsk.com/">Chrome List</a> view files in chrome:// (<a class="external" href="http://addons.mozilla.org/en-US/firefox/addon/4453" rel="external nofollow" title="http://addons.mozilla.org/en-US/firefox/addon/4453">Firefox</a>, <a class="external" href="http://addons.mozilla.org/en-US/thunderbird/addon/4453" rel="external nofollow" title="http://addons.mozilla.org/en-US/thunderbird/addon/4453">Thunderbird</a>)</li> + <li><a href="/en/Mozmill" title="en/Mozmill">Mozmill</a> test tool and framework</li> + <li><a class="external" href="http://xpcomviewer.mozdev.org/" rel="external nofollow" title="http://xpcomviewer.mozdev.org">XPCOMViewer</a> an XPCOM inspector (Firefox and Thunderbird)</li> + </ul> + + <p>... <a class="internal" href="/en/Setting_up_extension_development_environment#Development_extensions" title="en/Setting up extension development environment#Development extensions">more tools</a> ...</p> + + <p><span class="alllinks"><a href="/Special:Tags?tag=Extensions:Tools&language=en" title="Special:Tags?tag=Extensions:Tools&language=en">View All...</a></span></p> + + <h2 id="Related_Topics" name="Related_Topics">Related Topics</h2> + + <dl> + <dd><a href="/en/XUL" title="en/XUL">XUL</a>, <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>, <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a>, <a href="/en/Themes" title="en/Themes">Themes</a>, <a href="/En/Developer_Guide" title="en/Developing_Mozilla">Developing Mozilla</a></dd> + </dl> + </td> + </tr> + </tbody> +</table> + +<p><span class="comment">Categories</span></p> + +<p>{{ languages( { "ja": "ja/Extensions/Thunderbird" } ) }}</p> diff --git a/files/zh-tw/mozilla/thunderbird/thunderbird_extensions/theme_packaging/index.html b/files/zh-tw/mozilla/thunderbird/thunderbird_extensions/theme_packaging/index.html new file mode 100644 index 0000000000..9aeb61d94f --- /dev/null +++ b/files/zh-tw/mozilla/thunderbird/thunderbird_extensions/theme_packaging/index.html @@ -0,0 +1,105 @@ +--- +title: 包裝佈景主題 +slug: Mozilla/Thunderbird/Thunderbird_extensions/Theme_Packaging +tags: + - Toolkit API + - 佈景主題 +translation_of: Mozilla/Thunderbird/Thunderbird_extensions/Theme_Packaging +--- +<p>本文描述包裝 Firefox 及 Thunderbird 之<a href="zh_tw/%e4%bd%88%e6%99%af%e4%b8%bb%e9%a1%8c">佈景主題</a>的方法。</p> +<h3 id=".E9.9C.80.E6.B1.82" name=".E9.9C.80.E6.B1.82">需求</h3> +<p>製作 Firefox 或 Thunderbird 的佈景主題需要懂層疊樣式表(<a href="zh_tw/CSS">CSS</a>)、會一點 <a href="zh_tw/XBL">XBL</a>、還要有美術繪圖設計等能力(不過也不見得一定要)。本文只說明包裝佈景主題以便顯示於 Firefox 佈景主題視窗的方法。</p> +<h3 id=".E4.BD.88.E6.99.AF.E4.B8.BB.E9.A1.8C.E6.AA.94.E6.A1.88.E6.9E.B6.E6.A7.8B" name=".E4.BD.88.E6.99.AF.E4.B8.BB.E9.A1.8C.E6.AA.94.E6.A1.88.E6.9E.B6.E6.A7.8B">佈景主題檔案架構</h3> +<p>Firefox 及 Thunderbird 的佈景主題是一個將資料以下列結構包裝的 JAR 檔案:</p> +<pre class="eval">theme.jar: + install.rdf + contents.rdf + preview.png + icon.png + browser/<i>一堆檔案</i> + global/<i>一堆檔案</i> + mozapps/<i>一堆檔案</i> + communicator/<i>一堆檔案</i> + ... + +</pre> +<ul> + <li>最頂層必須有個 <a href="zh_tw/Chrome.manifest">chrome.manifest</a> 檔(適用於 Firefox 或 Thunderbird 1.5 以上)或 contents.rdf 來將佈景主題註冊到 chrome 中,另外還需要一個 <a href="zh_tw/Install.rdf">install.rdf</a> 清單記載佈景主題視窗中需要用到的資訊。</li> + <li>preview.png 是佈景主題視窗中會出現的預覽圖,尺寸大小不限。</li> + <li>icon.png 是 32x32 的 PNG 檔(可以有 alpha 半透明資訊),會出現於佈景主題視窗的佈景列表中。</li> +</ul> +<h3 id="install.rdf" name="install.rdf">install.rdf</h3> +<p><a href="zh_tw/Install.rdf">install.rdf</a> 清單長得像這樣:</p> +<pre class="eval"><span class="nowiki"><?xml version="1.0"?> + + <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + + <Description about="urn:mozilla:install-manifest"> + <em:type>4</em:type> + ''其他特性'' + </Description> + </RDF></span> +</pre> +<h4 id=".E5.BF.85.E5.82.99.E7.89.B9.E6.80.A7" name=".E5.BF.85.E5.82.99.E7.89.B9.E6.80.A7">必備特性</h4> +<p>install.rdf 檔中必須含有下列特性:</p> +<ul> + <li>em:id</li> + <li>em:version</li> + <li>em:type</li> + <li>em:targetApplication</li> + <li>em:name</li> + <li>em:internalName</li> +</ul> +<p>詳細資訊請見 <a href="zh_tw/Install.rdf">install.rdf 參考</a>。</p> +<h4 id=".E9.81.B8.E7.94.A8.E7.89.B9.E6.80.A7" name=".E9.81.B8.E7.94.A8.E7.89.B9.E6.80.A7">選用特性</h4> +<ul> + <li>em:description</li> + <li>em:creator</li> + <li>em:contributor</li> + <li>em:homepageURL</li> + <li>em:updateURL</li> +</ul> +<p>如果你想將佈景主題送上 <a class="external" href="http://addons.mozilla.org">addons.mozilla.org</a>,則 updateURL 就是必備的特性。</p> +<h4 id=".E7.AF.84.E4.BE.8B" name=".E7.AF.84.E4.BE.8B">範例</h4> +<pre class="eval"><span class="nowiki"><?xml version="1.0"?> + + <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + + <Description about="urn:mozilla:install-manifest"> + <em:id>{18b64b56-d42f-428d-a88c-baa413bc413f}</em:id> + <em:version>1.0</em:version> + <em:type>4</em:type> + + <!-- 擴充套件的適用軟體,含最低需求及上限版本資訊。 --> + <em:targetApplication> + <Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>0.8</em:minVersion> + <em:maxVersion>0.9</em:maxVersion> + </Description> + </em:targetApplication> + + <!-- 使用者會看到的資訊 --> + <em:name>New Theme 1</em:name> + <em:description>A test theme for Firefox</em:description> + <em:creator>Ben Goodger</em:creator> + <em:contributor>John Doe</em:contributor> + <em:homepageURL>http://www.bengoodger.com/</em:homepageURL> + + <!-- 佈景主題管理員內部所用的識別名稱 --> + <em:internalName>newtheme1</em:internalName> + </Description> + </RDF></span> +</pre> +<p>以下是幾個 targetApplication 特性常用的應用程式 GUID:</p> +<pre class="eval">Firefox {ec8030f7-c20a-464f-9b0e-13a3a9e97384} +Thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} +Sunbird {718e30fb-e89b-41dd-9da7-e25a45638b28} +</pre> +<h3 id="Toolkit_API_.E5.AE.98.E6.96.B9.E5.8F.83.E8.80.83.E6.96.87.E4.BB.B6" name="Toolkit_API_.E5.AE.98.E6.96.B9.E5.8F.83.E8.80.83.E6.96.87.E4.BB.B6"><a href="zh_tw/Toolkit_API">Toolkit API</a> 官方參考文件</h3> +<div> + {{page("/zh-TW/docs/Toolkit_API/Official_References")}}</div> +<div class="noinclude"> + </div> |