@@ -99,7 +99,9 @@ mod tests {
99
99
. replace ( '\r' , "" ) ;
100
100
assert_eq ! (
101
101
std:: str :: from_utf8(
102
- & base64:: decode( & reserialized[ 34 ] . content) . expect( "decode base64 content" )
102
+ & BASE64_STANDARD
103
+ . decode( & reserialized[ 34 ] . content)
104
+ . expect( "decode base64 content" )
103
105
)
104
106
. expect( "convert to utf8 string" ) ,
105
107
noopjs_contents,
@@ -191,7 +193,7 @@ mod tests {
191
193
) ;
192
194
assert_eq ! (
193
195
std:: str :: from_utf8(
194
- & base64 :: decode( & reserialized[ 20 ] . content) . expect( "decode base64 content" )
196
+ & BASE64_STANDARD . decode( & reserialized[ 20 ] . content) . expect( "decode base64 content" )
195
197
) . expect( "convert to utf8 string" ) ,
196
198
"(function() {\n if ( window !== window.top ) {\n return;\n }\n var tstart;\n var ttl = 30000;\n var delay = 0;\n var delayStep = 50;\n var buster = function() {\n var docEl = document.documentElement,\n bodyEl = document.body,\n vw = Math.min(docEl.clientWidth, window.innerWidth),\n vh = Math.min(docEl.clientHeight, window.innerHeight),\n tol = Math.min(vw, vh) * 0.05,\n el = document.elementFromPoint(vw/2, vh/2),\n style, rect;\n for (;;) {\n if ( el === null || el.parentNode === null || el === bodyEl ) {\n break;\n }\n style = window.getComputedStyle(el);\n if ( parseInt(style.zIndex, 10) >= 1000 || style.position === 'fixed' ) {\n rect = el.getBoundingClientRect();\n if ( rect.left <= tol && rect.top <= tol && (vw - rect.right) <= tol && (vh - rect.bottom) < tol ) {\n el.parentNode.removeChild(el);\n tstart = Date.now();\n el = document.elementFromPoint(vw/2, vh/2);\n bodyEl.style.setProperty('overflow', 'auto', 'important');\n docEl.style.setProperty('overflow', 'auto', 'important');\n continue;\n }\n }\n el = el.parentNode;\n }\n if ( (Date.now() - tstart) < ttl ) {\n delay = Math.min(delay + delayStep, 1000);\n setTimeout(buster, delay);\n }\n };\n var domReady = function(ev) {\n if ( ev ) {\n document.removeEventListener(ev.type, domReady);\n }\n tstart = Date.now();\n setTimeout(buster, delay);\n };\n if ( document.readyState === 'loading' ) {\n document.addEventListener('DOMContentLoaded', domReady);\n } else {\n domReady();\n }\n })();\n " ,
197
199
) ;
@@ -201,7 +203,7 @@ mod tests {
201
203
assert_eq ! ( reserialized[ 6 ] . kind, ResourceType :: Template ) ;
202
204
assert_eq ! (
203
205
std:: str :: from_utf8(
204
- & base64 :: decode( & reserialized[ 6 ] . content) . expect( "decode base64 content" )
206
+ & BASE64_STANDARD . decode( & reserialized[ 6 ] . content) . expect( "decode base64 content" )
205
207
) . expect( "convert to utf8 string" ) ,
206
208
"(function() {\n const rawPrunePaths = '{{1}}';\n const rawNeedlePaths = '{{2}}';\n const prunePaths = rawPrunePaths !== '{{1}}' && rawPrunePaths !== ''\n ? rawPrunePaths.split(/ +/)\n : [];\n let needlePaths;\n let log, reLogNeedle;\n if ( prunePaths.length !== 0 ) {\n needlePaths = prunePaths.length !== 0 &&\n rawNeedlePaths !== '{{2}}' && rawNeedlePaths !== ''\n ? rawNeedlePaths.split(/ +/)\n : [];\n } else {\n log = console.log.bind(console);\n let needle;\n if ( rawNeedlePaths === '' || rawNeedlePaths === '{{2}}' ) {\n needle = '.?';\n } else if ( rawNeedlePaths.charAt(0) === '/' && rawNeedlePaths.slice(-1) === '/' ) {\n needle = rawNeedlePaths.slice(1, -1);\n } else {\n needle = rawNeedlePaths.replace(/[.*+?^${}()|[\\ ]\\ \\ ]/g, '\\ \\ $&');\n }\n reLogNeedle = new RegExp(needle);\n }\n const findOwner = function(root, path, prune = false) {\n let owner = root;\n let chain = path;\n for (;;) {\n if ( typeof owner !== 'object' || owner === null ) {\n return false;\n }\n const pos = chain.indexOf('.');\n if ( pos === -1 ) {\n if ( prune === false ) {\n return owner.hasOwnProperty(chain);\n }\n if ( chain === '*' ) {\n for ( const key in owner ) {\n if ( owner.hasOwnProperty(key) === false ) { continue; }\n delete owner[key];\n }\n } else if ( owner.hasOwnProperty(chain) ) {\n delete owner[chain];\n }\n return true;\n }\n const prop = chain.slice(0, pos);\n if (\n prop === '[]' && Array.isArray(owner) ||\n prop === '*' && owner instanceof Object\n ) {\n const next = chain.slice(pos + 1);\n let found = false;\n for ( const key of Object.keys(owner) ) {\n found = findOwner(owner[key], next, prune) || found;\n }\n return found;\n }\n if ( owner.hasOwnProperty(prop) === false ) { return false; }\n owner = owner[prop];\n chain = chain.slice(pos + 1);\n }\n };\n const mustProcess = function(root) {\n for ( const needlePath of needlePaths ) {\n if ( findOwner(root, needlePath) === false ) {\n return false;\n }\n }\n return true;\n };\n const pruner = function(o) {\n if ( log !== undefined ) {\n const json = JSON.stringify(o, null, 2);\n if ( reLogNeedle.test(json) ) {\n log('uBO:', location.hostname, json);\n }\n return o;\n }\n if ( mustProcess(o) === false ) { return o; }\n for ( const path of prunePaths ) {\n findOwner(o, path, true);\n }\n return o;\n };\n JSON.parse = new Proxy(JSON.parse, {\n apply: function() {\n return pruner(Reflect.apply(...arguments));\n },\n });\n Response.prototype.json = new Proxy(Response.prototype.json, {\n apply: function() {\n return Reflect.apply(...arguments).then(o => pruner(o));\n },\n });\n })();\n " ,
207
209
) ;
@@ -283,7 +285,7 @@ mod tests {
283
285
) ;
284
286
assert_eq ! (
285
287
std:: str :: from_utf8(
286
- & base64 :: decode( & reserialized[ 18 ] . content) . expect( "decode base64 content" )
288
+ & BASE64_STANDARD . decode( & reserialized[ 18 ] . content) . expect( "decode base64 content" )
287
289
) . expect( "convert to utf8 string" ) ,
288
290
"(function() {\n if ( window !== window.top ) {\n return;\n }\n var tstart;\n var ttl = 30000;\n var delay = 0;\n var delayStep = 50;\n var buster = function() {\n var docEl = document.documentElement,\n bodyEl = document.body,\n vw = Math.min(docEl.clientWidth, window.innerWidth),\n vh = Math.min(docEl.clientHeight, window.innerHeight),\n tol = Math.min(vw, vh) * 0.05,\n el = document.elementFromPoint(vw/2, vh/2),\n style, rect;\n for (;;) {\n if ( el === null || el.parentNode === null || el === bodyEl ) {\n break;\n }\n style = window.getComputedStyle(el);\n if ( parseInt(style.zIndex, 10) >= 1000 || style.position === 'fixed' ) {\n rect = el.getBoundingClientRect();\n if ( rect.left <= tol && rect.top <= tol && (vw - rect.right) <= tol && (vh - rect.bottom) < tol ) {\n el.parentNode.removeChild(el);\n tstart = Date.now();\n el = document.elementFromPoint(vw/2, vh/2);\n bodyEl.style.setProperty('overflow', 'auto', 'important');\n docEl.style.setProperty('overflow', 'auto', 'important');\n continue;\n }\n }\n el = el.parentNode;\n }\n if ( (Date.now() - tstart) < ttl ) {\n delay = Math.min(delay + delayStep, 1000);\n setTimeout(buster, delay);\n }\n };\n var domReady = function(ev) {\n if ( ev ) {\n document.removeEventListener(ev.type, domReady);\n }\n tstart = Date.now();\n setTimeout(buster, delay);\n };\n if ( document.readyState === 'loading' ) {\n document.addEventListener('DOMContentLoaded', domReady);\n } else {\n domReady();\n }\n })();\n " ,
289
291
) ;
0 commit comments