Skip to content

Commit

Permalink
patch for Runtime.Enable done
Browse files Browse the repository at this point in the history
  • Loading branch information
bskdany committed Nov 8, 2023
1 parent 2afd857 commit f2d57b8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions utils/build_patcher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const fs = require('fs');

function patch_driver(path){
console.log("Patching driver for " + path)

function commentRuntimeEnable(path){
fileText = fs.readFileSync(path, 'utf8')
const regex = new RegExp(".*Runtime\.enable.*", "g");
const matchedRegex = fileText.match(regex)
for(const target of matchedRegex){
fileText = fileText.replace(target, "// " + target);
}
fs.writeFileSync(path,fileText)
return true
}

// comment occurencies of Runtime.Enable
const filesToPatch = ["crDevTools.ts", "crPage.ts","crServiceWorker.ts"]
for( file of filesToPatch){
if(commentRuntimeEnable(path + "chromium/" + file)){
console.log("Succesfully patched " + file)
}
}

// patching execution context
frames_path = path + "frames.js"
}

patch_driver('../packages/playwright-core/src/server/')

0 comments on commit f2d57b8

Please sign in to comment.