| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 (function() | 1 (function() |
| 2 { | 2 { |
| 3 let server = null; | 3 let server = null; |
| 4 let frame = null; | 4 let frame = null; |
| 5 let requestNotifier = null; | 5 let requestNotifier = null; |
| 6 let httpProtocol = null; | 6 let httpProtocol = null; |
| 7 | 7 |
| 8 module("Content policy", { | 8 module("Content policy", { |
| 9 setup: function() | 9 setup: function() |
| 10 { | 10 { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 start(); | 41 start(); |
| 42 }); | 42 }); |
| 43 | 43 |
| 44 Utils.httpProtocol = httpProtocol; | 44 Utils.httpProtocol = httpProtocol; |
| 45 } | 45 } |
| 46 }); | 46 }); |
| 47 | 47 |
| 48 /* | 48 /* |
| 49 -----BEGIN RSA PRIVATE KEY----- | 49 -----BEGIN RSA PRIVATE KEY----- |
| 50 MIIBOgIBAAJBANLNgMGCl6kc3QE/73/ESBsuhzCNQWApqWS1nKVWf+RjDTiF80LD | 50 MIIBOQIBAAJBALZc50pEXnz9TSRozwM04rryuaXl/wgUFqV9FHq8HDlkdKvRU0hX |
| 51 2TiTdQhlW9mlWsDDbttsDlEcCmPVz6H3OUMCAwEAAQJBALo/ZSYTqsl4ve7vvTwG | 51 hb/AKrSpCJ0NCxHtal1l/kHYlHG9e7Ev6+MCAwEAAQJBALRxYs5irhgAz2b6afOj |
| 52 gKq7ZihIdV1wEcDwELGoBiESo87zl//7q2q9/7VE3dB3Qp6uZMLtxVvXzF8bh074 | 52 TcFr0PRtipckwW/IPw5euZKyvswEJt/tWDv4OdmDnRe8FSy6FG2Got3zxvaxYdc3 |
| 53 OuECIQDzzenwgPVMtg6OjMtZBAB95oKaTzd+x/8JienKW4edEQIhAN1Y+vlB/waB | 53 AXkCIQDfFGcytIVq3sbdF3lmhzcXf29R4Hrxg/eoByAKabxknwIhANFGSNMOGPt6 |
| 54 miRjGMrsOQDHhUbxyL6NXaPfxYlosYETAiBg0M9qgztl+BH1x7FkqvMrC+OnNXf7 | 54 JRajfB9XmsltQJzbkr2sfHgjMN2FLM49AiAH6tt2yz1o+5snQawHXYkxBk7XIxZ5 |
| 55 L552gj7F7ez/kQIgOBNhyaHxlNlijpNYZZhAvLTPS/DXFYdE0M5RAgW26mcCIDrR | 55 9+sURZx3giUzlQIfXF+pxX9zh41i0ZtYLn181WxkGNjS7OY2CtF9wEoIfQIgcHuf |
| 56 fi2xaM2NqJQCmyshtNmDxW2FCrtrQn1n0211WCEe | 56 shh1qrvuKiXnD9b72PF676laKdzxzX5rX6cZZLA= |
| 57 -----END RSA PRIVATE KEY----- | 57 -----END RSA PRIVATE KEY----- |
| 58 */ | 58 */ |
| 59 let publickey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLNgMGCl6kc3QE/73/ESBsuhzCNQ WApqWS1nKVWf+RjDTiF80LD2TiTdQhlW9mlWsDDbttsDlEcCmPVz6H3OUMCAwEAAQ"; | 59 let publickey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZc50pEXnz9TSRozwM04rryuaXl/ wgUFqV9FHq8HDlkdKvRU0hXhb/AKrSpCJ0NCxHtal1l/kHYlHG9e7Ev6+MCAwEAAQ"; |
|
Wladimir Palant
2014/09/10 21:55:06
There are some RSA keys in https://hg.adblockplus.
Thomas Greiner
2014/12/11 14:33:55
Done.
| |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Content: | 62 * Content: |
| 63 * /test\0127.0.0.1:1234\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0) Gec ko/20100101 Firefox/30.0 | 63 * /test\0127.0.0.1:1234\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0) Gec ko/20100101 Firefox/30.0 |
| 64 */ | 64 */ |
| 65 let sitekey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLNgMGCl6kc3QE/73/ESBsuhzCNQWA pqWS1nKVWf+RjDTiF80LD2TiTdQhlW9mlWsDDbttsDlEcCmPVz6H3OUMCAwEAAQ==_peQ1CvuHieDHAX URwy9K8VQFaPWHHU0oDGT3pnIoQ6Nm7DUvCPw6FsnqfpdoIcq+kwqtkgWIcxM95gytuphvzQ=="; | 65 let adblockkey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZc50pEXnz9TSRozwM04rryuaXl /wgUFqV9FHq8HDlkdKvRU0hXhb/AKrSpCJ0NCxHtal1l/kHYlHG9e7Ev6+MCAwEAAQ==_gM4C/j8KkD2 byPeP+THXk1GbLTUm5y+5jbdhcMtnzPMgImIfge0dGCtfU9cxLpe8BnqnEGNhTxpuu4pZxjOHYQ=="; |
|
Wladimir Palant
2014/09/10 21:55:06
Call this variable "signature"?
Thomas Greiner
2014/12/11 14:33:55
Technically, it's a concatentation of public key a
| |
| 66 | 66 |
| 67 let tests = [ | 67 let tests = [ |
| 68 [ | 68 [ |
| 69 "HTML image with relative URL", | 69 "HTML image with relative URL", |
| 70 '<img src="test.gif">', | 70 '<img src="test.gif">', |
| 71 "http://127.0.0.1:1234/test.gif", "image", false, false | 71 "http://127.0.0.1:1234/test.gif", "image", false, false |
| 72 ], | 72 ], |
| 73 [ | 73 [ |
| 74 "HTML image with absolute URL", | 74 "HTML image with absolute URL", |
| 75 '<img src="http://localhost:1234/test.gif">', | 75 '<img src="http://localhost:1234/test.gif">', |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 | 263 |
| 264 let serverHit = false; | 264 let serverHit = false; |
| 265 server.registerPathHandler("/test", function(metadata, response) | 265 server.registerPathHandler("/test", function(metadata, response) |
| 266 { | 266 { |
| 267 response.setStatusLine("1.1", "200", "OK"); | 267 response.setStatusLine("1.1", "200", "OK"); |
| 268 | 268 |
| 269 let contentType = "text/html"; | 269 let contentType = "text/html"; |
| 270 if (body.indexOf("2000/svg") >= 0) | 270 if (body.indexOf("2000/svg") >= 0) |
| 271 { | 271 { |
| 272 contentType = "image/svg+xml"; | 272 contentType = "image/svg+xml"; |
| 273 body = body.replace(/^<svg/, "<svg data-adblockkey='" + sitekey + "'"); | 273 body = body.replace(/^<svg/, "<svg data-adblockkey='" + adblockkey + "'" ); |
| 274 } | 274 } |
| 275 else | 275 else |
| 276 body = "<html data-adblockkey='" + sitekey + "'>" + body + "</html>"; | 276 body = "<html data-adblockkey='" + adblockkey + "'>" + body + "</html>"; |
| 277 response.setHeader("Content-Type", contentType + "; charset=utf-8"); | 277 response.setHeader("Content-Type", contentType + "; charset=utf-8"); |
| 278 | 278 |
| 279 response.bodyOutputStream.write(body, body.length); | 279 response.bodyOutputStream.write(body, body.length); |
| 280 }); | 280 }); |
| 281 server.registerPathHandler("/redirect.gif", function(metadata, response) | 281 server.registerPathHandler("/redirect.gif", function(metadata, response) |
| 282 { | 282 { |
| 283 response.setStatusLine("1.1", "302", "Moved Temporarily"); | 283 response.setStatusLine("1.1", "302", "Moved Temporarily"); |
| 284 response.setHeader("Location", "http://127.0.0.1:1234/test.gif"); | 284 response.setHeader("Location", "http://127.0.0.1:1234/test.gif"); |
| 285 }); | 285 }); |
| 286 server.registerPathHandler("/redirect2.gif", function(metadata, response) | 286 server.registerPathHandler("/redirect2.gif", function(metadata, response) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 for (let stage = 1; stage in stageDescriptions; stage++) | 355 for (let stage = 1; stage in stageDescriptions; stage++) |
| 356 { | 356 { |
| 357 let stageDescription = stageDescriptions[stage]; | 357 let stageDescription = stageDescriptions[stage]; |
| 358 if (stageDescription.indexOf("%S") >= 0) | 358 if (stageDescription.indexOf("%S") >= 0) |
| 359 stageDescription = stageDescription.replace("%S", expectedURL); | 359 stageDescription = stageDescription.replace("%S", expectedURL); |
| 360 | 360 |
| 361 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage)); | 361 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage)); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 })(); | 364 })(); |
| LEFT | RIGHT |