Module: wine Branch: master Commit: 57af3f1e72122644db3ba5e37b5c44f0f0c0721e URL: https://gitlab.winehq.org/wine/wine/-/commit/57af3f1e72122644db3ba5e37b5c44f...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jul 10 21:20:14 2024 +0200
mshtml/tests: Add script context test.
---
dlls/mshtml/tests/es5.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index b04c13de984..3d00f39cbc3 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2658,3 +2658,33 @@ sync_test("builtin_func", function() { ok(f.call(o, "test", 1) === false, 'f.call(o, "test", 1) = ' + f.call(o, "test", 1)); ok("" + f === "\nfunction hasFeature() {\n [native code]\n}\n", "f = " + f); }); + +async_test("script_global", function() { + // Created documents share script global, so their objects are instances of Object from + // the current script context. + var doc = document.implementation.createHTMLDocument("test"); + todo_wine. + ok(doc instanceof Object, "created doc is not an instance of Object"); + todo_wine. + ok(doc.implementation instanceof Object, "created doc.implementation is not an instance of Object"); + + document.body.innerHTML = ""; + var iframe = document.createElement("iframe"); + + // Documents created in iframe use iframe's script global, so their objects are not instances of + // current script context Object. + iframe.onload = guard(function() { + var doc = iframe.contentWindow.document; + ok(!(doc instanceof Object), "doc is an instance of Object"); + ok(!(doc.implementation instanceof Object), "doc.implementation is an instance of Object"); + + doc = doc.implementation.createHTMLDocument("test"); + ok(!(doc instanceof Object), "created iframe doc is an instance of Object"); + ok(!(doc.implementation instanceof Object), "created iframe doc.implementation is an instance of Object"); + + next_test(); + }); + + iframe.src = "about:blank"; + document.body.appendChild(iframe); +});