Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html manifest="/security/powerfulFeatureRestrictions/resources/simple.manifest" > | 2 <html manifest="/security/powerfulFeatureRestrictions/resources/simple.manifest" > |
| 3 <head> | 3 <head> |
| 4 <title>Old Powerful Features on an Insecure Origin</title> | 4 <title>Old Powerful Features on an Insecure Origin</title> |
| 5 </head> | 5 </head> |
| 6 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src="/resources/get-host-info.js"></script> | 8 <script src="/resources/get-host-info.js"></script> |
| 9 | 9 |
| 10 <body> | 10 <body> |
| 11 <div id="target"></div> | 11 <div id="target"></div> |
| 12 <script> | 12 <script> |
| 13 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { | 13 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
| 14 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p athname; | 14 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p athname; |
| 15 } else { | 15 } else { |
| 16 if (!window.internals) | 16 if (!window.internals) |
| 17 assert_unreached('window.internals is required for this test'); | 17 assert_unreached('window.internals is required for this test'); |
| 18 | 18 |
| 19 | |
| 20 // Tests for APIs that are deprecated, but still allowed, on | 19 // Tests for APIs that are deprecated, but still allowed, on |
| 21 // insecure origins | 20 // insecure origins |
| 22 async_test(function() { | 21 async_test(function() { |
| 23 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, | 22 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, |
| 24 true, 0, true, 0, true, 0, | 23 true, 0, true, 0, true, 0, |
| 25 true, 0, true, 0, true, 0, | 24 true, 0, true, 0, true, 0, |
| 26 0); | 25 0); |
| 27 window.addEventListener('devicemotion', this.step_func_done()); | 26 window.addEventListener('devicemotion', this.step_func_done()); |
| 28 }, 'device motion'); | 27 }, 'device motion'); |
| 29 | 28 |
| 30 async_test(function() { | 29 async_test(function() { |
| 31 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); | 30 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); |
| 32 window.addEventListener('deviceorientation', this.step_func_done()); | 31 window.addEventListener('deviceorientation', this.step_func_done()); |
| 33 }, 'device orientation'); | 32 }, 'device orientation'); |
| 34 | 33 |
| 35 promise_test(function(test) { | |
| 36 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', | |
| 37 [{ videoCapabilities: [{contentType: 'video/webm; codecs="vp9"'}] }] ); | |
| 38 }, 'requestMediaKeySystemAccess'); | |
| 39 | |
| 40 // Tests for APIs that have been turned off on insecure origins | 34 // Tests for APIs that have been turned off on insecure origins |
| 41 async_test(function() { | 35 async_test(function() { |
| 42 navigator.geolocation.getCurrentPosition( | 36 navigator.geolocation.getCurrentPosition( |
| 43 this.unreached_func('getCurrentPosition should fail, but succeeded.' ), | 37 this.unreached_func('getCurrentPosition should fail, but succeeded.' ), |
| 44 this.step_func_done(function(error) { | 38 this.step_func_done(function(error) { |
| 45 assert_equals(error.code, error.PERMISSION_DENIED); | 39 assert_equals(error.code, error.PERMISSION_DENIED); |
| 46 })); | 40 })); |
| 47 }, 'getCurrentPosition'); | 41 }, 'getCurrentPosition'); |
| 48 | 42 |
| 49 // Note that the deprecation message for watchPosition() will be suppressed | 43 // Note that the deprecation message for watchPosition() will be suppressed |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 80 assert_equals(response.status, 200); | 74 assert_equals(response.status, 200); |
| 81 response.text().then(this.step_func_done(function(data) { | 75 response.text().then(this.step_func_done(function(data) { |
| 82 assert_equals(data, "Hello, World!"); | 76 assert_equals(data, "Hello, World!"); |
| 83 })); | 77 })); |
| 84 })) | 78 })) |
| 85 .catch(this.unreached_func("fetch() for cachable resource unexpe ctedly failed")); | 79 .catch(this.unreached_func("fetch() for cachable resource unexpe ctedly failed")); |
| 86 }); | 80 }); |
| 87 | 81 |
| 88 applicationCache.addEventListener('cached', cached, false); | 82 applicationCache.addEventListener('cached', cached, false); |
| 89 }, 'appcache'); | 83 }, 'appcache'); |
| 84 | |
| 85 test(function() { | |
| 86 assert_false(navigator.hasOwnProperty('requestMediaKeySystemAccess'), | |
|
foolip
2017/02/07 00:06:11
navigator.hasOwnProperty('requestMediaKeySystemAcc
xhwang
2017/02/07 00:23:56
I am not super familiar with this code, but here's
foolip
2017/02/07 00:27:12
That's odd, I've tested in Chrome Stable and Chrom
| |
| 87 'navigator.requestMediaKeySystemAccess should not be available.'); | |
| 88 }, 'requestMediaKeySystemAccess'); | |
| 90 } | 89 } |
| 91 </script> | 90 </script> |
| 92 </body> | 91 </body> |
| 93 </html> | 92 </html> |
| OLD | NEW |