| Index: LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
 | 
| diff --git a/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html b/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
 | 
| index 02416fd36f618e53b637aee5639e03cafdf16a01..b5b56246330c1651dda1cd7b99ac56b1721b2f14 100644
 | 
| --- a/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
 | 
| +++ b/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
 | 
| @@ -1,28 +1,46 @@
 | 
|  <!DOCTYPE html>
 | 
|  <html>
 | 
|  <body>
 | 
| -    <script src="/js-test-resources/js-test.js"></script>
 | 
| -    <script>
 | 
| -        description("The image bitmap factories should throw exceptions on cross-origin access.");
 | 
| +<script src="/js-test-resources/js-test.js"></script>
 | 
| +<script>
 | 
| +description("The image bitmap factories should throw exceptions on cross-origin access.");
 | 
|  
 | 
| -        window.jsTestIsAsync = true;
 | 
| +window.jsTestIsAsync = true;
 | 
| +var reason;
 | 
|  
 | 
| -        var img = document.createElement('img');
 | 
| -        var vid = document.createElement('video');
 | 
| +function shouldBeRejected(promise, message) {
 | 
| +    return promise.then(function() {
 | 
| +        testFailed('Resolved unexpectedly: ' + message);
 | 
| +    }, function(e) {
 | 
| +        reason = e;
 | 
| +        testPassed('Rejected as expected: ' + message);
 | 
| +        shouldBeTrue('reason instanceof Error');
 | 
| +        debug(e);
 | 
| +    });
 | 
| +}
 | 
|  
 | 
| -        document.body.appendChild(img);
 | 
| -        img.src = 'http://localhost:8080/security/resources/abe.png';
 | 
| -        img.addEventListener('load', function () {
 | 
| -            shouldThrow('createImageBitmap(img, 0, 0, 10, 10)', '"SecurityError: Failed to execute \'createImageBitmap\' on \'Window\': Cross-origin access to the source image is denied."');
 | 
| -
 | 
| -            vid.src = 'http://localhost:8080/media/resources/load-video.php?name=test.ogv&type=video/ogv';
 | 
| -            vid.addEventListener('playing', function () {
 | 
| -                shouldThrow('createImageBitmap(vid, 0, 0, 10, 10)', '"SecurityError: Failed to execute \'createImageBitmap\' on \'Window\': Cross-origin access to the source video is denied."');
 | 
| -                finishJSTest();
 | 
| -            });
 | 
| -            document.body.appendChild(vid);
 | 
| -            vid.play();
 | 
| -        });
 | 
| -    </script>
 | 
| +Promise.resolve().then(function() {
 | 
| +    return new Promise(function(resolve, reject) {
 | 
| +        var image = document.createElement('img');
 | 
| +        image.addEventListener('load', resolve.bind(undefined, image));
 | 
| +        image.src = 'http://localhost:8080/security/resources/abe.png';
 | 
| +        document.body.appendChild(image);
 | 
| +    }).then(function(image) {
 | 
| +        return shouldBeRejected(createImageBitmap(image, 0, 0, 10, 10), 'image');
 | 
| +    });
 | 
| +}).then(function() {
 | 
| +    return new Promise(function(resolve, reject) {
 | 
| +        var video = document.createElement('video');
 | 
| +        video.src = 'http://localhost:8080/media/resources/load-video.php?name=test.ogv&type=video/ogv';
 | 
| +        video.addEventListener('playing', resolve.bind(undefined, video));
 | 
| +        document.body.appendChild(video);
 | 
| +        video.play();
 | 
| +    }).then(function(video) {
 | 
| +        return shouldBeRejected(createImageBitmap(video, 0, 0, 10, 10), 'video');
 | 
| +    });
 | 
| +}).catch(function(e) {
 | 
| +    testFailed('Unexpected rejection: ' + e);
 | 
| +}).then(finishJSTest, finishJSTest);
 | 
| +</script>
 | 
|  </body>
 | 
|  </html>
 | 
| 
 |