Commit 61c03048 authored by Maja Kabus's avatar Maja Kabus Committed by Commit Bot

HTMLObjectElement changed to accept Trusted Types

Modified data and codeBase attributes definition in *.idl file.

Bug: 739170
Change-Id: Ia332493450d0e780e4e6eb332708216da02060d1
Reviewed-on: https://chromium-review.googlesource.com/1137824
Commit-Queue: Maja Kabus <kabusm@google.com>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarDaniel Vogelheim <vogelheim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576465}
parent 245d832b
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testData(str, url) {
var objectElement = document.createElement('object');
objectElement.data = url;
objectElement.codeBase = url;
assert_equals(objectElement.data, str);
assert_equals(objectElement.codeBase,str);
}
test(t => {
testData(URLS.safe, TrustedURL.create(URLS.safe));
}, "Basic processing: safe URL, safe construction.");
test(t => {
testData(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "Basic processing: safe URL, unsafe construction.");
</script>
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testData(str, url) {
var objectElement = document.createElement('object');
objectElement.data = url;
objectElement.codeBase = url;
assert_equals(objectElement.data, str);
assert_equals(objectElement.codeBase, str);
}
//URL assignments do not throw
test(t => {
testData(URLS.safe, TrustedURL.create(URLS.safe));
}, "Basic processing: safe URL, safe construction.");
test(t => {
testData(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "Basic processing: safe URL, unsafe construction.");
//String assignments throw
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.data = "A string";
});
}, "`objectElement.data = string` throws");
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.codeBase = "A string";
});
}, "`objectElement.codeBase = string` throws");
//Null assignment throws.
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.data = null;
});
}, "`objectElement.data = null` throws");
//Null assignment throws.
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.codeBase = null;
});
}, "`objectElement.codeBase = null` throws");
</script>
......@@ -26,7 +26,7 @@
ActiveScriptWrappable,
HTMLConstructor
] interface HTMLObjectElement : HTMLElement {
[CEReactions, Reflect, URL] attribute DOMString data;
[CEReactions, Reflect, URL, RaisesException=Setter] attribute URLString data;
[CEReactions, Reflect] attribute DOMString type;
// TODO(foolip): attribute boolean typeMustMatch;
[CEReactions, Reflect] attribute DOMString name;
......@@ -55,7 +55,7 @@
[CEReactions, Reflect] attribute unsigned long hspace;
[CEReactions, Reflect] attribute DOMString standby;
[CEReactions, Reflect] attribute unsigned long vspace;
[CEReactions, Reflect, URL] attribute DOMString codeBase;
[CEReactions, Reflect, URL, RaisesException=Setter] attribute URLString codeBase;
[CEReactions, Reflect] attribute DOMString codeType;
[CEReactions, Reflect] attribute [TreatNullAs=EmptyString] DOMString border;
......
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