| <!DOCTYPE html> |
| <style> |
| body { |
| height: 10000px; |
| width: 10000px; |
| } |
| </style> |
| |
| <body></body> |
| |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <script type="text/javascript"> |
| 'use strict'; |
| async_test(function(t) { |
| window.addEventListener('load', t.step_func(function() { |
| document.body.offsetTop; // force layout |
| if (window.name != 'verification') { |
| assert_array_equals([window.innerWidth, window.innerHeight], [800, 600], 'initial page size is valid'); |
| if (window.internals) { |
| window.internals.setPageScaleFactor(2); |
| assert_array_equals([internals.visualViewportWidth(), internals.visualViewportHeight()], [400, 300], 'page is scaled'); |
| } |
| |
| history.scrollRestoration = 'manual'; |
| window.scrollTo(100, 200); |
| assert_equals(history.scrollRestoration, 'manual'); |
| assert_array_equals([window.scrollX, window.scrollY], [100, 200]); |
| |
| setTimeout(function() { |
| window.name = 'verification'; |
| window.location = "data:text/html,<script>history.back();</scr" + "ipt>"; |
| }, 0); |
| } else { |
| assert_array_equals([internals.visualViewportWidth(), internals.visualViewportHeight()], [400, 300], 'page scale is restored'); |
| assert_array_equals([window.scrollX, window.scrollY], [0, 0], 'scroll position is not restored'); |
| // clean up |
| window.name = ''; |
| if (window.internals) |
| setTimeout(function() {window.internals.setPageScaleFactor(1);}, 0); |
| t.done(); |
| } |
| })); |
| }, 'Setting scrollRestoration to manual should not affect scale restoration'); |
| </script> |