forked from microsoft/playwright
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/') |