Skip to content

Commit

Permalink
Allow scriptlets to be injected in about:blank
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 16, 2023
1 parent c292a90 commit 3fd2588
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/js/scriptlet-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,11 @@ const mainWorldInjector = (( ) => {
const parts = [
'(',
function(injector, details) {
if ( typeof self.uBO_scriptletsInjected === 'string' ) { return; }
const doc = document;
if (
doc.location === null ||
details.hostname !== doc.location.hostname ||
typeof self.uBO_scriptletsInjected === 'string'
) {
return;
}
if ( doc.location === null ) { return; }
const hostname = doc.location.hostname;
if ( hostname !== '' && details.hostname !== hostname ) { return; }
injector(doc, details);
return 0;
}.toString(),
Expand All @@ -193,14 +190,11 @@ const isolatedWorldInjector = (( ) => {
const parts = [
'(',
function(details) {
if ( self.uBO_isolatedScriptlets === 'done' ) { return; }
const doc = document;
if (
doc.location === null ||
details.hostname !== doc.location.hostname ||
self.uBO_isolatedScriptlets === 'done'
) {
return;
}
if ( doc.location === null ) { return; }
const hostname = doc.location.hostname;
if ( hostname !== '' && details.hostname !== hostname ) { return; }
const isolatedScriptlets = function(){};
isolatedScriptlets();
self.uBO_isolatedScriptlets = 'done';
Expand Down

0 comments on commit 3fd2588

Please sign in to comment.