| OLD | NEW | 
|   1 <!DOCTYPE html> |   1 <!DOCTYPE html> | 
|   2 <html> |   2 <html> | 
|   3 <head> |   3 <head> | 
|   4 <script src="/js-test-resources/js-test.js"></script> |   4 <script src="/js-test-resources/js-test.js"></script> | 
|   5 </head> |   5 </head> | 
|   6 <body> |   6 <body> | 
 |   7 <iframe id="cross-origin-frame" | 
 |   8         src="http://localhost:8000/resources/dummy.html"> | 
 |   9 </iframe> | 
|   7 <script> |  10 <script> | 
|   8 description("Cross-origin access to 'window.location.pathname' over 'get' and 's
    et' in property descriptor should throw a SecurityError."); |  11 description("Cross-origin access through 'get' and 'set' in a property descripto
    r should throw a SecurityError."); | 
|   9  |  12  | 
|  10 window.jsTestIsAsync = true; |  13 window.jsTestIsAsync = true; | 
|  11 window.testRunner.setCanOpenWindows(true); |  | 
|  12  |  14  | 
|  13 var targetWindow = window.open("http://localhost:8080/"); |  15 var targetFrame = window['cross-origin-frame']; | 
 |  16 shouldBeNonNull(targetFrame); | 
 |  17 var targetWindow = targetFrame.contentWindow; | 
 |  18 shouldBeNonNull(targetWindow); | 
|  14  |  19  | 
|  15 var pathnameDescriptor = Object.getOwnPropertyDescriptor(Location.prototype, "pa
    thname"); |  20 var pathnameDescriptor = Object.getOwnPropertyDescriptor(location, "pathname"); | 
|  16 shouldBeNonNull("pathnameDescriptor"); |  21 shouldBeNonNull("pathnameDescriptor"); | 
|  17 shouldBe("typeof pathnameDescriptor.get", '"function"'); |  22 shouldBe("typeof pathnameDescriptor.get", '"function"'); | 
|  18 shouldBe("typeof pathnameDescriptor.set", '"function"'); |  23 shouldBe("typeof pathnameDescriptor.set", '"function"'); | 
|  19  |  24  | 
|  20 var count = 0; |  25 var devicePixelRatioDescriptor = Object.getOwnPropertyDescriptor(window, "device
    PixelRatio"); | 
|  21 var timerId = window.setInterval(function() { |  26 shouldBeNonNull("devicePixelRatio"); | 
|  22     if (++count > 10) { |  27 shouldBe("typeof devicePixelRatioDescriptor.get", '"function"'); | 
|  23         window.clearInterval(timerId); |  28 shouldBe("typeof devicePixelRatioDescriptor.set", '"function"'); | 
|  24         finishJSTest(); |  29  | 
|  25         return; |  30 targetFrame.onload = function() { | 
|  26     } |  31   shouldThrow("pathnameDescriptor.get.call(targetWindow.location)", '"SecurityEr
    ror: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cr
    oss-origin frame."'); | 
|  27     if (targetWindow) { |  32   shouldThrow("pathnameDescriptor.set.call(targetWindow.location, 1)", '"Securit
    yError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a
     cross-origin frame."'); | 
|  28         shouldThrow("pathnameDescriptor.get.call(targetWindow.location)", '"Secu
    rityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessin
    g a cross-origin frame."'); |  33  | 
|  29         shouldThrow("pathnameDescriptor.set.call(targetWindow.location, 1)", '"S
    ecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from acces
    sing a cross-origin frame."'); |  34   shouldThrow("devicePixelRatioDescriptor.get.call(targetWindow)", '"SecurityErr
    or: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cro
    ss-origin frame."'); | 
|  30         window.clearInterval(timerId); |  35   shouldThrow("devicePixelRatioDescriptor.set.call(targetWindow, 1)", '"Security
    Error: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a 
    cross-origin frame."'); | 
|  31         finishJSTest(); |  36  | 
|  32     } |  37   finishJSTest(); | 
|  33 }, 1000); |  38 }; | 
|  34 </script> |  39 </script> | 
|  35 </body> |  40 </body> | 
|  36 </html> |  41 </html> | 
| OLD | NEW |