mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-27 16:40:07 +00:00
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:
parent
4a6e3ba045
commit
f8d9cdebdb
|
@ -10,7 +10,7 @@
|
||||||
"license-name": "GPL-2.0-or-later AND BSD-3-Clause",
|
"license-name": "GPL-2.0-or-later AND BSD-3-Clause",
|
||||||
"type": "editor",
|
"type": "editor",
|
||||||
"requires": {
|
"requires": {
|
||||||
"MediaWiki": ">= 1.32.0",
|
"MediaWiki": ">= 1.35.0",
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"WikiEditor": ">= 0.5.2"
|
"WikiEditor": ">= 0.5.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ class CodeEditorHooks {
|
||||||
if ( $lang && $output->getUser()->getOption( 'usebetatoolbar' ) ) {
|
if ( $lang && $output->getUser()->getOption( 'usebetatoolbar' ) ) {
|
||||||
$output->addModules( 'ext.codeEditor' );
|
$output->addModules( 'ext.codeEditor' );
|
||||||
$output->addJsConfigVars( 'wgCodeEditorCurrentLanguage', $lang );
|
$output->addJsConfigVars( 'wgCodeEditorCurrentLanguage', $lang );
|
||||||
|
// Needed because ACE adds a blob: url web-worker.
|
||||||
|
$output->getCSP()->addScriptSrc( "blob:" );
|
||||||
} elseif ( !ExtensionRegistry::getInstance()->isLoaded( "WikiEditor" ) ) {
|
} elseif ( !ExtensionRegistry::getInstance()->isLoaded( "WikiEditor" ) ) {
|
||||||
throw new ErrorPageError( "codeeditor-error-title", "codeeditor-error-message" );
|
throw new ErrorPageError( "codeeditor-error-title", "codeeditor-error-message" );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue