Make CodeEditor compatible with CSP

Adds a "script-src blob:" directive on pages using CodeEditor.
This should allow using the blob-based web-worker that ACE uses.

This bumps the MediaWiki dependency to current master (1.35.0+).

Bug: T214743
Depends-on: I68054644220cd03bc96cf8ffb9c7ee375be77f96
Change-Id: I40612274a7e1d964119433442d992a8bf67f61af
This commit is contained in:
Brian Wolff 2019-10-28 02:02:20 -07:00 committed by James D. Forrester
parent 4a6e3ba045
commit f8d9cdebdb
2 changed files with 3 additions and 1 deletions

View file

@ -10,7 +10,7 @@
"license-name": "GPL-2.0-or-later AND BSD-3-Clause",
"type": "editor",
"requires": {
"MediaWiki": ">= 1.32.0",
"MediaWiki": ">= 1.35.0",
"extensions": {
"WikiEditor": ">= 0.5.2"
}

View file

@ -50,6 +50,8 @@ class CodeEditorHooks {
if ( $lang && $output->getUser()->getOption( 'usebetatoolbar' ) ) {
$output->addModules( 'ext.codeEditor' );
$output->addJsConfigVars( 'wgCodeEditorCurrentLanguage', $lang );
// Needed because ACE adds a blob: url web-worker.
$output->getCSP()->addScriptSrc( "blob:" );
} elseif ( !ExtensionRegistry::getInstance()->isLoaded( "WikiEditor" ) ) {
throw new ErrorPageError( "codeeditor-error-title", "codeeditor-error-message" );
}