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.

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

mercurial