| <!DOCTYPE html> |
| <!-- |
| | Compare the types of properties common to both the Cobalt window object and |
| | Chrome window object, and ensure that they match. |
| --> |
| <html> |
| <head> |
| <title>platform-object-user-properties-survive-gc</title> |
| <style> |
| #result { |
| width: 100px; |
| height:100px; |
| background-color:#0047AB; |
| } |
| </style> |
| </head> |
| <body> |
| |
| <div id="result"></div> |
| |
| <script> |
| function expect(condition, message) { |
| if (!condition) { |
| document.querySelector('#result').style.display = 'none'; |
| if (typeof message !== 'undefined') { |
| console.error(message); |
| } 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) { |
| continue; |
| } |
| |
| let actual = typeof window[key]; |
| // And if we don't have the property, also count it is a pass. |
| if (typeof actual === 'undefined') { |
| continue; |
| } |
| |
| expect( |
| actual === expected, |
| `Type mismatch on ${key}, actual: ${actual}, expected: ${expected}.`); |
| } |
| |
| </script> |
| |
| </body> |
| </html> |