Module: wine
Branch: master
Commit: e6f7a759ed80da115ffbcc5e9777d485153f6cdf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e6f7a759ed80da115ffbcc5e9…
Author: Jacek Caban <jacek(a)codeweavers.com>
Date: Tue Dec 12 15:28:04 2017 +0100
mshtml/tests: Added a test of calls to functions from different frame.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
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(+)
diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
index 6e193ee..a16194f 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 = '<iframe src="runscript.html?frame.js"></iframe>'
+ 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 0000000..588405c
--- /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 ec2b729..df5b469 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 0000000..a4d0ac5
--- /dev/null
+++ b/dlls/mshtml/tests/runscript.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ </head>
+ <script>
+ var q = document.location.search.replace("?", "");
+ if(q) document.write('<s'+'cript src="' + q + '"></s'+'cript>');
+ </script>
+ <body>
+ </body>
+</html>