blob: 87bf30e3ad2b4744eccc0d0342887cb6c0a2a8e7 [file] [log] [blame]
<!DOCTYPE html>
| Compare the types of properties common to both the Cobalt window object and
| Chrome window object, and ensure that they match.
#result {
width: 100px;
<div id="result"></div>
function expect(condition, message) {
if (!condition) {
document.querySelector('#result').style.display = 'none';
if (typeof message !== 'undefined') {
} else {
console.error('!condition block reached in |expect|');
// A mapping from |key| -> |typeof window[key]| in Chrome 62.
// This map was generated by running:
// let result = 'let expectedMap = {\n';
// for (let key in window) {
// result += ` ${key}: '${typeof window[key]}',\n`;
// }
// result += '};\n';
let expectedMap = {
addEventListener: 'function',
alert: 'function',
applicationCache: 'object',
atob: 'function',
blur: 'function',
btoa: 'function',
caches: 'object',
cancelAnimationFrame: 'function',
cancelIdleCallback: 'function',
captureEvents: 'function',
chrome: 'object',
clearInterval: 'function',
clearTimeout: 'function',
clientInformation: 'object',
close: 'function',
closed: 'boolean',
confirm: 'function',
createImageBitmap: 'function',
crypto: 'object',
customElements: 'object',
defaultStatus: 'string',
defaultstatus: 'string',
devicePixelRatio: 'number',
dispatchEvent: 'function',
document: 'object',
external: 'object',
fetch: 'function',
find: 'function',
focus: 'function',
frameElement: 'object',
frames: 'object',
getComputedStyle: 'function',
getMatchedCSSRules: 'function',
getSelection: 'function',
history: 'object',
indexedDB: 'object',
innerHeight: 'number',
innerWidth: 'number',
isSecureContext: 'boolean',
length: 'number',
localStorage: 'object',
location: 'object',
locationbar: 'object',
matchMedia: 'function',
menubar: 'object',
moveBy: 'function',
moveTo: 'function',
name: 'string',
navigator: 'object',
onabort: 'object',
onanimationend: 'object',
onanimationiteration: 'object',
onanimationstart: 'object',
onappinstalled: 'object',
onauxclick: 'object',
onbeforeinstallprompt: 'object',
onbeforeunload: 'object',
onblur: 'object',
oncancel: 'object',
oncanplay: 'object',
oncanplaythrough: 'object',
onchange: 'object',
onclick: 'object',
onclose: 'object',
oncontextmenu: 'object',
oncuechange: 'object',
ondblclick: 'object',
ondevicemotion: 'object',
ondeviceorientation: 'object',
ondeviceorientationabsolute: 'object',
ondrag: 'object',
ondragend: 'object',
ondragenter: 'object',
ondragleave: 'object',
ondragover: 'object',
ondragstart: 'object',
ondrop: 'object',
ondurationchange: 'object',
onemptied: 'object',
onended: 'object',
onerror: 'object',
onfocus: 'object',
ongotpointercapture: 'object',
onhashchange: 'object',
oninput: 'object',
oninvalid: 'object',
onkeydown: 'object',
onkeypress: 'object',
onkeyup: 'object',
onlanguagechange: 'object',
onload: 'object',
onloadeddata: 'object',
onloadedmetadata: 'object',
onloadstart: 'object',
onlostpointercapture: 'object',
onmessage: 'object',
onmessageerror: 'object',
onmousedown: 'object',
onmouseenter: 'object',
onmouseleave: 'object',
onmousemove: 'object',
onmouseout: 'object',
onmouseover: 'object',
onmouseup: 'object',
onmousewheel: 'object',
onoffline: 'object',
ononline: 'object',
onpagehide: 'object',
onpageshow: 'object',
onpause: 'object',
onplay: 'object',
onplaying: 'object',
onpointercancel: 'object',
onpointerdown: 'object',
onpointerenter: 'object',
onpointerleave: 'object',
onpointermove: 'object',
onpointerout: 'object',
onpointerover: 'object',
onpointerup: 'object',
onpopstate: 'object',
onprogress: 'object',
onratechange: 'object',
onrejectionhandled: 'object',
onreset: 'object',
onresize: 'object',
onscroll: 'object',
onsearch: 'object',
onseeked: 'object',
onseeking: 'object',
onselect: 'object',
onstalled: 'object',
onstorage: 'object',
onsubmit: 'object',
onsuspend: 'object',
ontimeupdate: 'object',
ontoggle: 'object',
ontransitionend: 'object',
onunhandledrejection: 'object',
onunload: 'object',
onvolumechange: 'object',
onwaiting: 'object',
onwebkitanimationend: 'object',
onwebkitanimationiteration: 'object',
onwebkitanimationstart: 'object',
onwebkittransitionend: 'object',
onwheel: 'object',
open: 'function',
openDatabase: 'function',
opener: 'object',
origin: 'string',
outerHeight: 'number',
outerWidth: 'number',
pageXOffset: 'number',
pageYOffset: 'number',
parent: 'object',
performance: 'object',
PERSISTENT: 'number',
personalbar: 'object',
postMessage: 'function',
print: 'function',
prompt: 'function',
releaseEvents: 'function',
removeEventListener: 'function',
requestAnimationFrame: 'function',
requestIdleCallback: 'function',
resizeBy: 'function',
resizeTo: 'function',
screen: 'object',
screenLeft: 'number',
screenTop: 'number',
screenX: 'number',
screenY: 'number',
scroll: 'function',
scrollbars: 'object',
scrollBy: 'function',
scrollTo: 'function',
scrollX: 'number',
scrollY: 'number',
self: 'object',
sessionStorage: 'object',
setInterval: 'function',
setTimeout: 'function',
speechSynthesis: 'object',
status: 'string',
statusbar: 'object',
stop: 'function',
styleMedia: 'object',
TEMPORARY: 'number',
toolbar: 'object',
top: 'object',
visualViewport: 'object',
webkitCancelAnimationFrame: 'function',
webkitRequestAnimationFrame: 'function',
webkitRequestFileSystem: 'function',
webkitResolveLocalFileSystemURL: 'function',
webkitStorageInfo: 'object',
window: 'object',
for (let key in window) {
let expected = expectedMap[key];
// If we don't have a value to compare to, then be generous count it as a
// pass.
if (!expected) {
let actual = typeof window[key];
// And if we don't have the property, also count it is a pass.
if (typeof actual === 'undefined') {
actual === expected,
`Type mismatch on ${key}, actual: ${actual}, expected: ${expected}.`);