mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-24 23:41:14 +02:00
remove deprecated code
This commit is contained in:
@@ -142,9 +142,6 @@ export default class ContentWrap extends Component {
|
|||||||
const versionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
|
const versionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
|
||||||
|
|
||||||
const shouldInlineJs = true;
|
const shouldInlineJs = true;
|
||||||
// !window.webkitRequestFileSystem ||
|
|
||||||
// !window.IS_EXTENSION ||
|
|
||||||
// (versionMatch && +versionMatch[1] >= 104);
|
|
||||||
var contents = getCompleteHtml(
|
var contents = getCompleteHtml(
|
||||||
html,
|
html,
|
||||||
css,
|
css,
|
||||||
@@ -160,7 +157,6 @@ export default class ContentWrap extends Component {
|
|||||||
trackEvent.hasTrackedCode = true;
|
trackEvent.hasTrackedCode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldInlineJs) {
|
|
||||||
if (this.detachedWindow) {
|
if (this.detachedWindow) {
|
||||||
log('✉️ Sending message to detached window');
|
log('✉️ Sending message to detached window');
|
||||||
this.detachedWindow.postMessage({ contents }, '*');
|
this.detachedWindow.postMessage({ contents }, '*');
|
||||||
@@ -188,12 +184,8 @@ export default class ContentWrap extends Component {
|
|||||||
log('resolved with ', resolutionReason);
|
log('resolved with ', resolutionReason);
|
||||||
fn();
|
fn();
|
||||||
});
|
});
|
||||||
// Setting to blank string cause frame to reload
|
|
||||||
// if (window.IS_EXTENSION) {
|
|
||||||
// this.frame.src = '';
|
|
||||||
// } else {
|
|
||||||
this.frame.src = this.frame.src;
|
this.frame.src = this.frame.src;
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
const writeInsideIframe = () => {
|
const writeInsideIframe = () => {
|
||||||
if (!cachedSandboxAttribute && window.DEBUG) {
|
if (!cachedSandboxAttribute && window.DEBUG) {
|
||||||
@@ -201,13 +193,7 @@ export default class ContentWrap extends Component {
|
|||||||
}
|
}
|
||||||
log('sending PM');
|
log('sending PM');
|
||||||
|
|
||||||
// if (window.IS_EXTENSION) {
|
|
||||||
// this.frame.contentDocument.open();
|
|
||||||
// this.frame.contentDocument.write(contents);
|
|
||||||
// this.frame.contentDocument.close();
|
|
||||||
// } else {
|
|
||||||
this.frame.contentWindow.postMessage({ contents }, '*');
|
this.frame.contentWindow.postMessage({ contents }, '*');
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
// refreshAndDo(() => {
|
// refreshAndDo(() => {
|
||||||
// cachedSandboxAttribute = this.frame.getAttribute('sandbox');
|
// cachedSandboxAttribute = this.frame.getAttribute('sandbox');
|
||||||
@@ -218,24 +204,6 @@ export default class ContentWrap extends Component {
|
|||||||
// });
|
// });
|
||||||
refreshAndDo(writeInsideIframe);
|
refreshAndDo(writeInsideIframe);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// DEPRECATED
|
|
||||||
// we need to store user script in external JS file to prevent inline-script
|
|
||||||
// CSP from affecting it.
|
|
||||||
writeFile('script.js', blobjs, () => {
|
|
||||||
writeFile('preview.html', blob, () => {
|
|
||||||
var origin = chrome.i18n.getMessage()
|
|
||||||
? `chrome-extension://${chrome.i18n.getMessage('@@extension_id')}`
|
|
||||||
: `${location.origin}`;
|
|
||||||
var src = `filesystem:${origin}/temporary/preview.html`;
|
|
||||||
if (this.detachedWindow) {
|
|
||||||
this.detachedWindow.postMessage({ url: src }, '*');
|
|
||||||
} else {
|
|
||||||
this.frame.src = src;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cleanupErrors(lang) {
|
cleanupErrors(lang) {
|
||||||
this.cm[lang].clearGutter('error-gutter');
|
this.cm[lang].clearGutter('error-gutter');
|
||||||
|
Reference in New Issue
Block a user