Skip to content

Commit

Permalink
feat: upgrade base chrome to 128
Browse files Browse the repository at this point in the history
  • Loading branch information
blakebyrnes committed Sep 23, 2024
1 parent 0be2da1 commit 67ee967
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 48 deletions.
24 changes: 3 additions & 21 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,12 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
node-version: [18, 20]
include:
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-123-0
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-122-0
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-121-0
- node-version: 20.x
os: ubuntu-latest
browser: chrome-125-0
- node-version: 20.x
os: ubuntu-latest
browser: chrome-120-0
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-119-0
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-118-0
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-117-0
# - node-version: 20.x
# os: ubuntu-latest
# browser: chrome-116-0
- node-version: 20.x
os: ubuntu-latest
browser: chrome-115-0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
node-version: [18, 20]
include:
- node-version: 18.x
- node-version: 20.x
os: ubuntu-latest
browser: chrome-114-0

Expand Down
2 changes: 1 addition & 1 deletion agent/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Fully programmable Devtools Protocol based browser",
"main": "index.js",
"dependencies": {
"@ulixee/chrome-124-0": "^6367.208.10",
"@ulixee/chrome-128-0": "^6613.138.11",
"@ulixee/chrome-app": "^1.0.3",
"@ulixee/commons": "2.0.0-alpha.29",
"@ulixee/js-path": "2.0.0-alpha.29",
Expand Down
21 changes: 9 additions & 12 deletions agent/main/test/Page.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,13 @@ describe('Pages', () => {
<div style="height: 200px; width: 100px; background:red">&nbsp;</div>`,
);
const screenshot = await page.screenshot({ format: 'png' });
expect(screenshot.toString('base64')).toContain(
'iVBORw0KGgoAAAANSUhEUgAABAAAAAOECAYAAAA/m0PDAAAAAXNSR0IArs4c6QAAFjhJREFUeJzt2rENw0AMBEG9of5bpkuQEulh70zM4OIF18zMAQAAAPy1z+4BAAAAwPMEAAAAAAgQAAAAACBAAAAAAIAA',
);

const viewport = await page.mainFrame.getWindowOffset();
expect(sizeOf(screenshot)).toStrictEqual({
width: viewport.innerWidth,
type: 'png',
height: viewport.innerHeight,
});
});

it('should screenshot only the visible page', async () => {
Expand All @@ -218,8 +222,6 @@ describe('Pages', () => {
type: 'jpg',
height: viewport.innerHeight,
});
expect(sizeOf(screenshot).height).toBe(viewport.innerHeight);
expect(sizeOf(screenshot).width).toBe(viewport.innerWidth);
});

it('should be able to take a clipped rect screenshot', async () => {
Expand All @@ -238,9 +240,7 @@ describe('Pages', () => {
scale: 1,
},
});
expect(screenshot.toString('base64')).toContain(
'iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAAAXNSR0IArs4c6QAAB',
);
expect(sizeOf(screenshot).height).toBe(500);
});

it('should be able to take a full page screenshot', async () => {
Expand All @@ -255,7 +255,6 @@ describe('Pages', () => {
jpegQuality: 1,
fullPage: true,
});
expect(screenshot.toString('base64')).toContain('4AAQSkZJRgABAQAAAQABAAD');
expect(sizeOf(screenshot).height).toBe(2700);
});

Expand All @@ -276,9 +275,7 @@ describe('Pages', () => {
scale: 1,
},
});
expect(screenshot.toString('base64')).toContain(
'AA0IHgAGhA8CA0AFgQOgAMCB0ABgQOgAMCB0ABoQOAANCB4ABoQPAgNABYEDoADAgdAAYEDoADAgdAAaEDgADQgeAAaEDwIDQAWBA6AAwIHQAGBA6AAwIHQAGhA4AA0IHgAGhA8CA0AFgQOgAMCB0ABgQOgAMCB0ABoQOAANCB4ABoQPAgNAB',
);
expect(sizeOf(screenshot).height).toBe(2700);
});
});

Expand Down
17 changes: 11 additions & 6 deletions agent/mitm/lib/MitmRequestAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,27 @@ export default class MitmRequestAgent {
}
});

let callbackArgs: any[];
let responseCallbackArgs: any[];
let upgradeCallbackArgs: any[];
request.once('response', (...args: any[]) => {
callbackArgs = args;
responseCallbackArgs = args;
});
request.once('upgrade', (...args: any[]) => {
callbackArgs = args;
upgradeCallbackArgs = args;
});

// we have to rebroadcast because this function is async, so the handlers can register late
const rebroadcastMissedEvent = (
event: string,
handler: (...args: any[]) => void,
): http.ClientRequest => {
if ((event === 'response' || event === 'upgrade') && callbackArgs) {
handler(...callbackArgs);
callbackArgs = null;
if (event === 'response' && responseCallbackArgs) {
handler(...responseCallbackArgs);
responseCallbackArgs = null;
}
if (event === 'upgrade' && upgradeCallbackArgs) {
handler(...upgradeCallbackArgs);
upgradeCallbackArgs = null;
}
// hand off to another fn
if (event === 'error') this.events.off(flushListener);
Expand Down
4 changes: 2 additions & 2 deletions end-to-end/test/resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('basic resource tests', () => {
</html>`;
});

koaServer.get('/foo/bar/42.css?x=foo&y=%20baz', ctx => {
koaServer.get('/foo/bar/42.css', ctx => {
ctx.statusCode = 500;
});
koaServer.get('/baz/bar.png', ctx => {
Expand Down Expand Up @@ -299,7 +299,7 @@ describe('basic resource tests', () => {
</html>`;
});

koaServer.get('/foo/bar/42.css?x=foo&y=%20baz', ctx => {
koaServer.get('/foo/bar/42.css', ctx => {
ctx.statusCode = 500;
});
koaServer.get('/baz/bar.png', ctx => {
Expand Down
1 change: 0 additions & 1 deletion plugins/default-browser-emulator/test/proxyLeak.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ test('string expansion trigger should not reveal different .toString location',
},
});

console.info(error);
return { wrongStack, seenStackInName, nameStack };
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1799,10 +1799,10 @@
dependencies:
"@ulixee/js-path" "^2.0.0-alpha.18"

"@ulixee/chrome-124-0@^6367.208.10":
version "6367.208.10"
resolved "https://registry.yarnpkg.com/@ulixee/chrome-124-0/-/chrome-124-0-6367.208.10.tgz#32a874efdc837487d14899da721ced4b51b3a463"
integrity sha512-3rn8vdd5m+coAZXgBMkerqN+cC9RaYiK1HwXC36lKkK2csIsl6Ekc+PNCZyyl/i33p6Y1+sXVzRwR26Npr+0OA==
"@ulixee/chrome-128-0@^6613.138.11":
version "6613.138.11"
resolved "https://registry.yarnpkg.com/@ulixee/chrome-128-0/-/chrome-128-0-6613.138.11.tgz#9836f79a6f2ae4babe06f6fb34a706dfb632584c"
integrity sha512-efglwyxEq0UW/Qr6lvMi25aDwv8Ea4XwrLmd/MFPKAThZXI+vg6NoirT7lbtJ0RF02G6dvVX1OoEXnZH8rfQjg==
dependencies:
"@ulixee/chrome-app" "^1.0.3"

Expand Down

0 comments on commit 67ee967

Please sign in to comment.