1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

wombat: add option to def_prop() to make overriden property enumerable, make WombatLocation and other loc overrides enumerable, fixes #163

This commit is contained in:
Ilya Kreymer 2015-12-18 21:46:50 -08:00
parent 79d5ec2b2d
commit 0cf6b40af9

View File

@ -364,7 +364,7 @@ var wombat_internal = function($wbwindow) {
//============================================ //============================================
// Override a DOM property // Override a DOM property
function def_prop(obj, prop, set_func, get_func) { function def_prop(obj, prop, set_func, get_func, enumerable) {
// if the property is marked as non-configurable in the current // if the property is marked as non-configurable in the current
// browser, skip the override // browser, skip the override
var existingDescriptor = Object.getOwnPropertyDescriptor(obj, prop); var existingDescriptor = Object.getOwnPropertyDescriptor(obj, prop);
@ -381,6 +381,7 @@ var wombat_internal = function($wbwindow) {
try { try {
var descriptor = { var descriptor = {
configurable: true, configurable: true,
enumerable: enumerable || false,
get: get_func, get: get_func,
}; };
@ -519,7 +520,7 @@ var wombat_internal = function($wbwindow) {
} }
function add_loc_prop(loc, prop) { function add_loc_prop(loc, prop) {
def_prop(loc, prop, make_set_loc_prop(prop), make_get_loc_prop(prop)); def_prop(loc, prop, make_set_loc_prop(prop), make_get_loc_prop(prop), true);
} }
if (Object.defineProperty) { if (Object.defineProperty) {