@percy/dom 1.32.11 → 1.32.12-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bundle.js +10 -9
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -23,10 +23,14 @@
23
23
  let [, mimetype] = data.split(':');
24
24
  [mimetype] = mimetype.split(';');
25
25
 
26
- // build a URL for the serialized asset
26
+ // build a root-relative URL for the serialized asset. It is same-origin by
27
+ // construction (served from wherever the captured page itself ends up), so
28
+ // it never needs a host or scheme baked in -- PPLT-6109: an absolute URL
29
+ // here previously carried over whatever scheme the local capture host used
30
+ // (typically http), which survives every downstream hostname rewrite and
31
+ // becomes a mixed-content block on any https render.
27
32
  let [, ext] = mimetype.split('/');
28
- let path = `/__serialized__/${uid}.${ext}`;
29
- let url = rewriteLocalhostURL(new URL(path, document.URL).toString());
33
+ let url = `/__serialized__/${uid}.${ext}`;
30
34
 
31
35
  // return the url, base64 content, and mimetype
32
36
  return {
@@ -36,10 +40,10 @@
36
40
  };
37
41
  }
38
42
  function resourceFromText(uid, mimetype, data) {
39
- // build a URL for the serialized asset
43
+ // build a root-relative URL for the serialized asset -- see
44
+ // resourceFromDataURL above for why this is relative, not absolute.
40
45
  let [, ext] = mimetype.split('/');
41
- let path = `/__serialized__/${uid}.${ext}`;
42
- let url = rewriteLocalhostURL(new URL(path, document.URL).toString());
46
+ let url = `/__serialized__/${uid}.${ext}`;
43
47
  // return the url, text content, and mimetype
44
48
  return {
45
49
  url,
@@ -66,9 +70,6 @@
66
70
  handleErrors(err, 'Failed to get stylesheet from node: ', node);
67
71
  }
68
72
  }
69
- function rewriteLocalhostURL(url) {
70
- return url.replace(/(http[s]{0,1}:\/\/)(localhost|127.0.0.1)[:\d+]*/, '$1render.percy.local');
71
- }
72
73
 
73
74
  // Utility function to handle errors
74
75
  function handleErrors(error, prefixMessage, element = null, additionalData = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.32.11",
3
+ "version": "1.32.12-beta.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "beta"
13
13
  },
14
14
  "main": "dist/bundle.js",
15
15
  "browser": "dist/bundle.js",
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "interactor.js": "^2.0.0-beta.10"
37
37
  },
38
- "gitHead": "fe385ef03c5dbeb599a0152eab855c9ce9875071"
38
+ "gitHead": "80a7983e35606c049956af87c5f74646cb2333fa"
39
39
  }