From 03a2a05fc7f2df9de95c7f3ff95a6ba058813580 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Mon, 10 Sep 2018 22:12:21 +0300 Subject: [PATCH] [effects/dialogparent] Fix strict mode issues Summary: Modification of undeclared variables is illegal in the strict mode, e.g. ```lang=js mainWindows = window.mainWindows(); ``` is illegal. Test Plan: The Dialog Parent effect works with both QScriptEngine and QJSEngine. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D15413 --- effects/dialogparent/package/contents/code/main.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/effects/dialogparent/package/contents/code/main.js b/effects/dialogparent/package/contents/code/main.js index d42c7b3ec5..2ca3c0e19b 100644 --- a/effects/dialogparent/package/contents/code/main.js +++ b/effects/dialogparent/package/contents/code/main.js @@ -23,7 +23,6 @@ var dialogParentEffect = { duration: animationTime(300), windowAdded: function (window) { "use strict"; - var mainWindows, i, w; if (window === null || window.modal === false) { return; } @@ -31,9 +30,9 @@ var dialogParentEffect = { }, dialogGotModality: function (window) { "use strict"; - mainWindows = window.mainWindows(); - for (i = 0; i < mainWindows.length; i += 1) { - w = mainWindows[i]; + var mainWindows = window.mainWindows(); + for (var i = 0; i < mainWindows.length; i += 1) { + var w = mainWindows[i]; if (w.dialogParentAnimation !== undefined) { continue; } @@ -59,7 +58,6 @@ var dialogParentEffect = { }, windowClosed: function (window) { "use strict"; - var mainWindows, i, w; dialogParentEffect.cancelAnimation(window); if (window.modal === false) { return; @@ -68,9 +66,9 @@ var dialogParentEffect = { }, dialogLostModality: function (window) { "use strict"; - mainWindows = window.mainWindows(); - for (i = 0; i < mainWindows.length; i += 1) { - w = mainWindows[i]; + var mainWindows = window.mainWindows(); + for (var i = 0; i < mainWindows.length; i += 1) { + var w = mainWindows[i]; if (w.dialogParentAnimation === undefined) { continue; }