From 677b9bbb246f7822642d9f75b38ba3a3f6320d8f Mon Sep 17 00:00:00 2001
From: Guillaume Delhumeau <guillaume.delhumeau@xwiki.com>
Date: Wed, 5 Oct 2016 16:50:16 +0200
Subject: [PATCH] XWIKI-13772: A warning is displayed on the log when a
 Flamingo Theme is being edited.

---
 .../src/main/resources/FlamingoThemesCode/ThemeSheet.xml   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml
index f646bd93e50..1ab4c71cfc6 100644
--- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml
+++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml
@@ -422,7 +422,12 @@
       // We run LESS in a thread in order to not block the main thread
       setTimeout(function(){
         // Run LESS (which use promises)
-        iframe[0].contentWindow.lessJs.modifyVars(varMap).then(removeCurtain).catch(removeCurtain);
+        // Note: because of yuicompressor which does not support Promise.prototype.catch() properly, we cannot
+        // call p.catch() directly (it generates an error in the logs).
+        // See http://jira.xwiki.org/browse/XWIKI-13772
+        // Instead, we use the following trick: p['catch']()
+        // TODO: remove this trick when we replace yuicompressor by something else.
+        iframe[0].contentWindow.lessJs.modifyVars(varMap).then(removeCurtain)['catch'](removeCurtain);
       }, 10);
     };
     
-- 
GitLab