Commit a92bb0b2 authored by Ayu Ishii's avatar Ayu Ishii Committed by Commit Bot

SMS Receiver: Test for detached iframe

Bug: 1027394
Change-Id: Ife6c3b001253d5fec64c3b6e9d4b5b9d6a7ba2e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1956076
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723040}
parent f2da03d5
<!DOCTYPE html>
<meta charset="utf-8">
<title>sms on DOMWindow of detached iframe</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<iframe id="iframe"></iframe>
<script>
'use strict';
promise_test(async t => {
const iframe = document.getElementById('iframe');
const smsReceiver = iframe.contentWindow.navigator.sms;
iframe.parentNode.removeChild(iframe);
try {
await smsReceiver.receive();
assert_unreached('Expected NotSupportedError to be thrown.');
} catch (error) {
assert_equals(error.name, 'NotSupportedError');
}
}, 'Return error when frame is inaccessible');
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment