-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from ulixee/emulators
Browser Emulators Clarification
- Loading branch information
Showing
153 changed files
with
3,819 additions
and
3,521 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import IHttpRequestModifierDelegate from '@secret-agent/commons/interfaces/IHttpRequestModifierDelegate'; | ||
import INetworkInterceptorDelegate from './INetworkInterceptorDelegate'; | ||
import IUserProfile from './IUserProfile'; | ||
import IUserAgent from './IUserAgent'; | ||
import IPageOverride from './IPageOverride'; | ||
import INewDocumentInjectedScript from './INewDocumentInjectedScript'; | ||
|
||
export default interface IBrowserEmulator { | ||
readonly userAgent: IUserAgent; | ||
canPolyfill: boolean; | ||
engineExecutablePath: string; | ||
engine: { browser: string; revision: string }; | ||
delegate: IHttpRequestModifierDelegate; | ||
readonly canPolyfill: boolean; | ||
readonly networkInterceptorDelegate: INetworkInterceptorDelegate; | ||
locale: string; | ||
userProfile: IUserProfile; | ||
|
||
generatePageOverrides(): Promise<IPageOverride[]>; | ||
newDocumentInjectedScripts(): Promise<INewDocumentInjectedScript[]>; | ||
} |
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,5 @@ | ||
export default interface IBrowserEngine { | ||
browser: string; | ||
revision: string; | ||
executablePath: string; | ||
} |
8 changes: 4 additions & 4 deletions
8
...ns/interfaces/IHttpResourceLoadDetails.ts → core-interfaces/IHttpResourceLoadDetails.ts
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,17 @@ | ||
export default interface ILog extends IBoundLog<ILogData> { | ||
level: string; | ||
flush(); | ||
} | ||
|
||
export interface IBoundLog<Base = any> { | ||
stats<T extends Base>(action: string, data?: T): number; | ||
info<T extends Base>(action: string, data?: T): number; | ||
warn<T extends Base>(action: string, data?: T): number; | ||
error<T extends Base>(action: string, data?: T): number; | ||
createChild(module, boundData?: any): IBoundLog; | ||
} | ||
|
||
export interface ILogData { | ||
sessionId: string; | ||
parentLogId?: number; | ||
} |
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,40 @@ | ||
import { ConnectionOptions } from 'tls'; | ||
import ResourceType from './ResourceType'; | ||
import IResourceHeaders from './IResourceHeaders'; | ||
import OriginType from './OriginType'; | ||
import IHttpResourceLoadDetails from './IHttpResourceLoadDetails'; | ||
|
||
export default interface INetworkInterceptorDelegate { | ||
tcp?: { windowSize: number; ttl: number }; | ||
tls?: { | ||
emulatorProfileId: string; | ||
}; | ||
dns?: { | ||
dnsOverTlsConnection: ConnectionOptions; | ||
}; | ||
connections?: { | ||
socketsPerOrigin: number; | ||
}; | ||
http: { | ||
requestHeaders?: (request: IResourceToModify) => { [key: string]: string }; | ||
cookieHeader?: (resource: IHttpResourceLoadDetails) => Promise<string>; | ||
onSetCookie?: ( | ||
cookie: string, | ||
resource: IHttpResourceLoadDetails, | ||
statusCode: number, | ||
) => Promise<void>; | ||
onOriginHasFirstPartyInteraction?: (documentUrl: string) => void; | ||
}; | ||
} | ||
|
||
export interface IResourceToModify { | ||
isServerHttp2: boolean; | ||
isClientHttp2: boolean; | ||
sessionId: string; | ||
resourceType: ResourceType; | ||
isSSL: boolean; | ||
method: string; | ||
originType: OriginType; | ||
lowerHeaders: IResourceHeaders; | ||
headers: IResourceHeaders; | ||
} |
2 changes: 1 addition & 1 deletion
2
core-interfaces/IPageOverride.ts → ...-interfaces/INewDocumentInjectedScript.ts
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,8 @@ | ||
import { EventEmitter } from "events"; | ||
import ITypedEventEmitter from "./ITypedEventEmitter"; | ||
|
||
export default interface IRegisteredEventListener { | ||
emitter: EventEmitter | ITypedEventEmitter<any>; | ||
eventName: string | symbol; | ||
handler: (...args: any[]) => void; | ||
} |
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,7 @@ | ||
export default interface IResolvablePromise<T = any> { | ||
isResolved: boolean; | ||
promise?: Promise<T>; | ||
resolve?: (value?: T | PromiseLike<T>) => void; | ||
reject?: (reason?: any) => void; | ||
timeout?: NodeJS.Timeout; | ||
} |
File renamed without changes.
File renamed without changes.
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
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
Oops, something went wrong.