From e6f7a759ed80da115ffbcc5e9777d485153f6cdf Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 12 Dec 2017 15:28:04 +0100 Subject: [PATCH] mshtml/tests: Added a test of calls to functions from different frame. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/tests/elements.js | 16 ++++++++++++++++ dlls/mshtml/tests/frame.js | 25 +++++++++++++++++++++++++ dlls/mshtml/tests/rsrc.rc | 6 ++++++ dlls/mshtml/tests/runscript.html | 11 +++++++++++ 4 files changed, 58 insertions(+) create mode 100644 dlls/mshtml/tests/frame.js create mode 100644 dlls/mshtml/tests/runscript.html diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js index 6e193ee5543..a16194f7294 100644 --- a/dlls/mshtml/tests/elements.js +++ b/dlls/mshtml/tests/elements.js @@ -104,6 +104,21 @@ function test_head() { next_test(); } +function test_iframe() { + document.body.innerHTML = '' + var iframe = document.body.firstChild; + + iframe.onload = guard(function() { + var r = iframe.contentWindow.global_object.get_global_value(); + ok(r === "global value", "get_global_value() returned " + r); + + var f = iframe.contentWindow.global_object.get_global_value; + ok(f() === "global value", "f() returned " + f()); + + next_test(); + }); +} + function test_getElementsByClassName() { var elems; @@ -178,6 +193,7 @@ var tests = [ test_ElementTraversal, test_getElementsByClassName, test_head, + test_iframe, test_query_selector, test_compare_position ]; diff --git a/dlls/mshtml/tests/frame.js b/dlls/mshtml/tests/frame.js new file mode 100644 index 00000000000..588405cfdc6 --- /dev/null +++ b/dlls/mshtml/tests/frame.js @@ -0,0 +1,25 @@ +/* + * Copyright 2017 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +var global_value = "global value"; + +var global_object = { + get_global_value: function() { + return global_value; + } +}; diff --git a/dlls/mshtml/tests/rsrc.rc b/dlls/mshtml/tests/rsrc.rc index ec2b72917ad..df5b469b4ee 100644 --- a/dlls/mshtml/tests/rsrc.rc +++ b/dlls/mshtml/tests/rsrc.rc @@ -34,6 +34,12 @@ vbtest.html HTML "vbtest.html" /* @makedep: events.html */ events.html HTML "events.html" +/* @makedep: runscript.html */ +runscript.html HTML "runscript.html" + +/* @makedep: frame.js */ +frame.js HTML "frame.js" + /* @makedep: externscr.js */ externscr.js HTML "externscr.js" diff --git a/dlls/mshtml/tests/runscript.html b/dlls/mshtml/tests/runscript.html new file mode 100644 index 00000000000..a4d0ac5013e --- /dev/null +++ b/dlls/mshtml/tests/runscript.html @@ -0,0 +1,11 @@ + + + + + + + +