1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-31 15:32:27 +01:00

Provide XPCNativeWrapper.unwrap if it doesn't exist. Closes issue #38.

This commit is contained in:
Kris Maglione
2010-10-04 10:20:07 -04:00
parent 6d472abb18
commit 9fdf43d46e

View File

@@ -14,6 +14,12 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let objproto = Object.prototype;
let hasOwnProperty = objproto.hasOwnProperty;
if (!XPCNativeWrapper.unwrap)
XPCNativeWrapper.unwrap = function (obj) {
if (hasOwnProperty.call(obj, "wrappedJSObject"))
return obj.wrappedJSObject;
return obj;
}
if (!Object.create)
Object.create = function (proto, props) {
let obj = { __proto__: proto };