toolkit/content/widgets/stringbundle.xml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <?xml version="1.0"?>
     2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     3    - License, v. 2.0. If a copy of the MPL was not distributed with this
     4    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <bindings id="stringBundleBindings"
     8           xmlns="http://www.mozilla.org/xbl"
     9           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    11   <binding id="stringbundleset" extends="xul:box"/>
    13   <binding id="stringbundle" extends="xul:spacer">
    14     <implementation name="XStringBundle">
    16       <method name="getString">
    17         <parameter name="aStringKey"/>
    18         <body>
    19           <![CDATA[
    20             try {
    21               return this.stringBundle.GetStringFromName(aStringKey);
    22             }
    23             catch (e) {
    24               dump("*** Failed to get string " + aStringKey + " in bundle: " + this.src + "\n");
    25               throw e;
    26             }
    27           ]]>
    28         </body>
    29       </method>
    31       <method name="getFormattedString">
    32         <parameter name="aStringKey"/>
    33         <parameter name="aStringsArray"/>
    34         <body>
    35           <![CDATA[
    36             try {
    37               return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
    38             }
    39             catch (e) {
    40               dump("*** Failed to format string " + aStringKey + " in bundle: " + this.src + "\n");
    41               throw e;
    42             }
    43           ]]>
    44         </body>
    45       </method>
    47       <property name="stringBundle" readonly="true">
    48         <getter>
    49           <![CDATA[
    50             if (!this._bundle) {
    51               try {
    52                 this._bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
    53                                          .getService(Components.interfaces.nsIStringBundleService)
    54                                          .createBundle(this.src);
    55               }
    56               catch (e) {
    57                 dump("Failed to get stringbundle:\n");
    58                 dump(e + "\n");
    59               }
    60             }
    61             return this._bundle;
    62           ]]>
    63         </getter>
    64       </property>
    66       <property name="src">
    67         <getter>
    68           <![CDATA[
    69             return this.getAttribute("src");
    70           ]]>
    71         </getter>
    72         <setter>
    73           <![CDATA[
    74             this._bundle = null;
    75             this.setAttribute("src", val);
    76             return val;
    77           ]]>
    78         </setter>
    79       </property>
    81       <property name="strings">
    82         <getter>
    83           <![CDATA[
    84             // Note: this is a sucky method name! Should be:
    85             //       readonly attribute nsISimpleEnumerator strings;
    86             return this.stringBundle.getSimpleEnumeration();
    87           ]]>
    88         </getter>
    89       </property>
    91       <field name="_bundle">null</field>
    93     </implementation>
    94   </binding>
    96 </bindings>

mercurial