function setupWorkerSupport() {

		function log( data ) {

			const { logType, msg } = data;
			console[ logType ]( '[Worker]', msg ); /* eslint-disable-line no-console */

		}

		function lostContext( /* data */ ) {

			addContextLostHTML();

		}

		function jsError( data ) {

			const { url, lineNo, colNo, msg } = data;
			reportJSError( url, lineNo, colNo, msg );

		}

		function jsErrorWithStack( data ) {

			const { url, stack, msg } = data;
			const errorInfo = parseStack( stack );
			if ( errorInfo ) {

				reportJSError( errorInfo.url || url, errorInfo.lineNo, errorInfo.colNo, msg );

			} else {

        console.error(errorMsg)  // eslint-disable-line
			}

		}

		const handlers = {
			log,
			lostContext,
			jsError,
			jsErrorWithStack,
		};
		const OrigWorker = self.Worker;
		class WrappedWorker extends OrigWorker {

			constructor( url, ...args ) {

				super( url, ...args );
				let listener;
				this.onmessage = function ( e ) {

					if ( ! e || ! e.data || e.data.type !== '___editor___' ) {

						if ( listener ) {

							listener( e );

						}

						return;

					}

					e.stopImmediatePropagation();
					const data = e.data.data;
					const fn = handlers[ data.type ];
					if ( typeof fn !== 'function' ) {

						origConsole.error( 'unknown editor msg:', data.type );

					} else {

						fn( data );

					}

					return;

				};

				Object.defineProperty( this, 'onmessage', {
					get() {

						return listener;

					},
					set( fn ) {

						listener = fn;

					},
				} );

			}

		}
		self.Worker = WrappedWorker;

	}
@parameter {string} stack A stack string as in `(new Error()).stack`
@returns {StackInfo}