-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move injectJS functionality to bidi for Firefox
- Loading branch information
1 parent
18fcbdf
commit aa995e0
Showing
6 changed files
with
38 additions
and
7 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
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
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,25 @@ | ||
import intel from 'intel'; | ||
const log = intel.getLogger('browsertime.firefox.bidi'); | ||
|
||
export class FirefoxBidi { | ||
constructor(bidi, browsingContextId, options) { | ||
this.options = options; | ||
this.bidi = bidi; | ||
this.browsingContextId = browsingContextId; | ||
} | ||
|
||
async injectJavaScript(script) { | ||
const params = { | ||
method: 'script.addPreloadScript', | ||
params: { | ||
functionDeclaration: script | ||
} | ||
}; | ||
|
||
try { | ||
await this.bidi.send(params); | ||
} catch (error) { | ||
log.error('Could not inject JavaScript:' + error); | ||
} | ||
} | ||
} |
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
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
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