From 0161e37e6e67ac6eb76fbc0bea4f299e17fcdda2 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Wed, 14 Nov 2018 21:01:22 +0100 Subject: [PATCH] Modules: Protect against loading modules twice Bug: T189029 Change-Id: Ie0dff9c1dfa8e3a0927f2915a9a237dff739289a --- modules/jquery.wikiEditor.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/jquery.wikiEditor.js b/modules/jquery.wikiEditor.js index bf36ad6c..83a13fc7 100644 --- a/modules/jquery.wikiEditor.js +++ b/modules/jquery.wikiEditor.js @@ -274,7 +274,10 @@ } } // Activate the module on this context - if ( 'fn' in $.wikiEditor.modules[ module ] && 'create' in $.wikiEditor.modules[ module ].fn ) { + if ( 'fn' in $.wikiEditor.modules[ module ] && + 'create' in $.wikiEditor.modules[ module ].fn && + typeof context.modules[ module ] === 'undefined' + ) { // Add a place for the module to put it's own stuff context.modules[ module ] = {}; // Tell the module to create itself on the context