Skip to content

Commit

Permalink
fix: embedded mode not working for blob:
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jul 20, 2022
1 parent 726b8a8 commit 37b27a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/DevtoolsFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class DevtoolsFrame {
const { targetOrigin } = this;
let protocol = location.protocol;
let host = location.host;
if (protocol === 'about:') {
if (protocol === 'about:' || protocol === 'blob:') {
protocol = window.parent.location.protocol;
host = window.parent.location.host;
}
Expand Down
7 changes: 6 additions & 1 deletion src/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import safeStorage from 'licia/safeStorage';
import $ from 'licia/$';
import contain from 'licia/contain';
import Socket from 'licia/Socket';
import ready from 'licia/ready';
import chobitsu from 'chobitsu';
import DevtoolsFrame from './DevtoolsFrame';

Expand Down Expand Up @@ -99,5 +100,9 @@ if (!embedded) {
} else {
const protocol = location.protocol === 'https:' ? 'https:' : 'http:';
const devtoolsFrame = new DevtoolsFrame(`${protocol}//${ChiiServerUrl}`);
devtoolsFrame.attach();
if (document.body) {
devtoolsFrame.attach();
} else {
ready(() => devtoolsFrame.attach());
}
}

0 comments on commit 37b27a4

Please sign in to comment.