1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

11 Commits

Author SHA1 Message Date
Ilya Kreymer
3e0bb49ae1
Use actual page scheme instead of defaulting to http when extracting original url (#404)
* client-side rewrite: fix extract_orig() to unrewrite relative urls using current page scheme, don't default to http

* wombat tests: fix karma tests by adding 'wombat_scheme' to test setup
2018-10-31 20:50:43 -07:00
John Berlin
b4d4be8a64 Advandced preservation of media query based style rules and complete preservation of srcset values to fix https://github.com/webrecorder/webrecorder/issues/64. (#359)
wombat.js:
- Finalized PreserveWorker that preserves srcset values and Media Query values
- Defered extraction and preservation of the values to be preserved so that the UI thread is not clobered
- Hooked into places where wombat rewrites the values we are interested in
wombatPreservationWorker.js:
- Updated handling of srcset extraction now that we are sending wombat srcset rewrites
- Added check to see if we have seen a URL to be fetched
- Added light polyfill of Promise and fetch if they are not defined in wombatPreservationWorker.js, for safari
wombat.spec.js
- Updated to include values necessary to work with PWorker changes.
2018-08-20 13:12:43 -07:00
Ilya Kreymer
20e49c7391 karma fixes: avoid accessing undef var 2017-03-14 12:28:13 -07:00
Ilya Kreymer
8ddf43684f karma: add stack trace 2017-03-14 12:14:04 -07:00
Ilya Kreymer
09a0779abb fix karma test for wombat change 2017-03-14 11:59:28 -07:00
Robert Knight
34721a6742 Override HTMLAnchorElement.prototype.toString()
The values returned by getting the 'href' and 'toString'
properties of an anchor element should be the same.

This inconsistency broke the URL polyfill in
https://github.com/inexorabletash/polyfill under Microsoft Edge
2015-12-02 20:09:09 +00:00
Robert Knight
1997c4a180 Run Karma tests against Microsoft Edge
* Increase the default timeouts to account for the relative
   slowness of setting up connections to remote browsers.

 * Change the URL into which Wombat JS is loaded for
   tests to be a valid URL. Under Microsoft Edge, the JS
   code in the page is not run if the URL fetch returns a 404.

 * Change assert.equal() implementation to avoid confusion due
   to Karma's reformatting of URLs in exception error messages.
2015-11-26 17:09:20 +00:00
Robert Knight
1484b06da6 Avoid changing the writability of the 'href' attr of <base>
Wombat overrides document.baseURI and <base>.href in order
to return the original URL rather than the proxied URL.

The <base>.href override however ended up making a writable
attribute read-only, which could trigger script errors
in strict-mode JS.

Fix this by avoiding replacing the setter for a DOM property
if no replacement setter is provided.

Fixes an error loading Hypothesis under Microsoft Edge.
2015-11-26 13:54:47 +00:00
Robert Knight
9c88b1fd20 Enable running Karma tests against Safari
Detect in the test whether overriding of DOM properties
is supported in the current environment and skip testing
for the baseURI override in that case.
2015-11-26 10:15:35 +00:00
Robert Knight
a4d05d469f Add configuration for running client tests using Sauce Labs
This gives us the capability to test the client-side JS
rewriting against a suite of different browsers on different
platforms.

Note that getting Karma running on Travis CI requires some
additional configuration documented at
github.com/karma-runner/karma-sauce-launcher/issues/73
which is not made clear in the original documentation.

In order to run the Karma tests, the Sauce Labs username
and access keys need to be passed in via the SAUCE_USERNAME
and SAUCE_ACCESS_KEYS env vars.
2015-11-25 14:57:20 +00:00
Robert Knight
f4a43a14f5 Add tests for the client-side part of pywb using Karma
* Add a Karma configuration for unit/integration tests
   for the client-side pywb code.

 * Add an integration test suite which creates an <iframe> loads
   the client-side rewriting code (wombat.js) in it and
   then executes a test script.

   Since wombat.js monkey-patches the DOM and the exact behavior
   of DOM objects varies between browsers, which we want to test,
   the suite does not mock the DOM but instead runs
   a set of tests in an isolated environment against
   the DOM.

 * Add Travis config to run the Karma tests
2015-11-25 11:53:40 +00:00