1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-23 15:01:14 +02:00

remove deprecated code

This commit is contained in:
Kushagra Gour
2024-05-10 14:24:17 +05:30
parent b64163f59c
commit a9931ab5fb

View File

@@ -142,9 +142,6 @@ export default class ContentWrap extends Component {
const versionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
const shouldInlineJs = true;
// !window.webkitRequestFileSystem ||
// !window.IS_EXTENSION ||
// (versionMatch && +versionMatch[1] >= 104);
var contents = getCompleteHtml(
html,
css,
@@ -160,7 +157,6 @@ export default class ContentWrap extends Component {
trackEvent.hasTrackedCode = true;
}
if (shouldInlineJs) {
if (this.detachedWindow) {
log('✉️ Sending message to detached window');
this.detachedWindow.postMessage({ contents }, '*');
@@ -188,12 +184,8 @@ export default class ContentWrap extends Component {
log('resolved with ', resolutionReason);
fn();
});
// Setting to blank string cause frame to reload
// if (window.IS_EXTENSION) {
// this.frame.src = '';
// } else {
this.frame.src = this.frame.src;
// }
};
const writeInsideIframe = () => {
if (!cachedSandboxAttribute && window.DEBUG) {
@@ -201,13 +193,7 @@ export default class ContentWrap extends Component {
}
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 }, '*');
// }
};
// refreshAndDo(() => {
// cachedSandboxAttribute = this.frame.getAttribute('sandbox');
@@ -218,24 +204,6 @@ export default class ContentWrap extends Component {
// });
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) {
this.cm[lang].clearGutter('error-gutter');