Hi
I have a content script in an addon that should format dates.
It works fine in scratchpad using window.Intl.DateTimeFormat
something like -
var date = new Date(Date.UTC(2012, 11, 20)); console.log(new Intl.DateTimeFormat().format(date));
When I test that code in my addon though, this error is thrown in the console -
"XrayWrapper denied access to property "DateTimeFormat" (reason: object is not safely Xrayable). See https://developer.mozilla.org/en-US/docs/Xray_vision"
From the details on the page about Xray vision, I can’t figure out how to get this to work.
Is there a different way to access objects like Date and Intl that should work from a content script?
I tried some things like gBrowser.contentWindow.date
, Components.utils.waiveXrays
and wrappedJSObject
.
Thanks