Last active
August 29, 2015 14:25
-
-
Save yajd/a990c50e55860186e3b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var yourStringBundle = Services.strings.createBundle('chrome://blah@jetpack/content/bootstrap.properties?' + Math.random()); /* Randomize URI to work around bug 719376 */ | |
var props = yourStringBundle.getSimpleEnumeration(); | |
// MDN says getSimpleEnumeration returns nsIPropertyElement // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStringBundle#getSimpleEnumeration%28%29 | |
while (props.hasMoreElements()) { | |
var prop = props.getNext(); | |
// doing console.log(prop) says its an XPCWrappedObject but we see QueryInterface (QI), so let's try QI'ing to nsiPropertyElement | |
var propEl = prop.QueryInterface(Ci.nsIPropertyElement); | |
// doing console.log(propEl) shows the object has some fields that interest us | |
var key = propEl.key; | |
var str = propEl.value; | |
console.info(key, str); // there you go | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
del