diff --git a/karma-tests/wombat.spec.js b/karma-tests/wombat.spec.js
index 8bebb8de..62fe9f72 100644
--- a/karma-tests/wombat.spec.js
+++ b/karma-tests/wombat.spec.js
@@ -121,45 +121,66 @@ describe('WombatJS', function () {
}, done);
});
- it('should rewrite document.baseURI', function (done) {
- runWombatTest({
- initScript: function () {
- wbinfo = {
- wombat_opts: {},
- prefix: window.location.origin,
- wombat_ts: '',
- };
- },
- wombatScript: wombatScript,
- testScript: function () {
- var baseURI = document.baseURI;
- if (typeof baseURI !== 'string') {
- throw new Error('baseURI is not a string');
- }
- if (domTests.areDOMPropertiesConfigurable()) {
- assert.equal(baseURI, 'http:///dummy.html');
- }
- },
- }, done);
+ describe('anchor rewriting', function () {
+ it('should rewrite links in dynamically injected tags', function (done) {
+ runWombatTest({
+ initScript: function () {
+ wbinfo = {
+ wombat_opts: {},
+ prefix: window.location.origin,
+ wombat_ts: '',
+ };
+ },
+ wombatScript: wombatScript,
+ html: 'A link',
+ testScript: function () {
+ var link = document.getElementById('link');
+ if (domTests.areDOMPropertiesConfigurable()) {
+ assert.equal(link.href, 'http:///foobar.html');
+ }
+ },
+ }, done);
+ });
});
- it('should rewrite links in dynamically injected tags', function (done) {
- runWombatTest({
- initScript: function () {
- wbinfo = {
- wombat_opts: {},
- prefix: window.location.origin,
- wombat_ts: '',
- };
- },
- wombatScript: wombatScript,
- html: 'A link',
- testScript: function () {
- var link = document.getElementById('link');
- if (domTests.areDOMPropertiesConfigurable()) {
- assert.equal(link.href, 'http:///foobar.html');
- }
- },
- }, done);
+ describe('base URL overrides', function () {
+ it('document.baseURI should return the original URL', function (done) {
+ runWombatTest({
+ initScript: function () {
+ wbinfo = {
+ wombat_opts: {},
+ prefix: window.location.origin,
+ wombat_ts: '',
+ };
+ },
+ wombatScript: wombatScript,
+ testScript: function () {
+ var baseURI = document.baseURI;
+ if (typeof baseURI !== 'string') {
+ throw new Error('baseURI is not a string');
+ }
+ if (domTests.areDOMPropertiesConfigurable()) {
+ assert.equal(baseURI, 'http:///dummy.html');
+ }
+ },
+ }, done);
+ });
+
+ it('should allow base.href to be assigned', function (done) {
+ runWombatTest({
+ initScript: function () {
+ wbinfo = {
+ wombat_opts: {},
+ };
+ },
+ wombatScript: wombatScript,
+ testScript: function () {
+ 'use strict';
+ var baseElement = document.createElement('base');
+ baseElement.href = 'http://foobar.com/base';
+ assert.equal(baseElement.href, 'http://foobar.com/base');
+ },
+ }, done);
+ });
});
});
diff --git a/pywb/static/wombat.js b/pywb/static/wombat.js
index 62f9bbb6..09ad23c4 100644
--- a/pywb/static/wombat.js
+++ b/pywb/static/wombat.js
@@ -379,11 +379,16 @@ var wombat_internal = function($wbwindow) {
}
try {
- Object.defineProperty(obj, prop, {
- configurable: false,
- set: set_func,
- get: get_func
- });
+ var descriptor = {
+ configurable: true,
+ get: get_func,
+ };
+
+ if (set_func) {
+ descriptor.set = set_func;
+ }
+
+ Object.defineProperty(obj, prop, descriptor);
return true;
} catch (e) {