Skip to content

Commit 8dfc738

Browse files
committed
update shared
1 parent aaaac68 commit 8dfc738

10 files changed

Lines changed: 30 additions & 23 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-77983e68be50f72a.js" defer=""></script><script src="./_next/static/chunks/pages/_error-54de1933a164a1ff.js" defer=""></script><script src="./_next/static/TTK2ht8frjy0sbNzW8tq6/_buildManifest.js" defer=""></script><script src="./_next/static/TTK2ht8frjy0sbNzW8tq6/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"TTK2ht8frjy0sbNzW8tq6","assetPrefix":".","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-77983e68be50f72a.js" defer=""></script><script src="./_next/static/chunks/pages/_error-54de1933a164a1ff.js" defer=""></script><script src="./_next/static/IC6xj1lLrrZr6c04YdiRW/_buildManifest.js" defer=""></script><script src="./_next/static/IC6xj1lLrrZr6c04YdiRW/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"IC6xj1lLrrZr6c04YdiRW","assetPrefix":".","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>

resources/newssite/news-next/dist/_next/static/TTK2ht8frjy0sbNzW8tq6/_buildManifest.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/newssite/news-next/dist/_next/static/TTK2ht8frjy0sbNzW8tq6/_ssgManifest.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/newssite/news-next/dist/_next/static/chunks/pages/index-84cd729ada3bc18c.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><link rel="preload" href="./_next/static/css/2cf5163b53bb0adb.css" as="style"/><link rel="stylesheet" href="./_next/static/css/2cf5163b53bb0adb.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-77983e68be50f72a.js" defer=""></script><script src="./_next/static/chunks/743-fd706aeabb7828e3.js" defer=""></script><script src="./_next/static/chunks/pages/index-84cd729ada3bc18c.js" defer=""></script><script src="./_next/static/TTK2ht8frjy0sbNzW8tq6/_buildManifest.js" defer=""></script><script src="./_next/static/TTK2ht8frjy0sbNzW8tq6/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"TTK2ht8frjy0sbNzW8tq6","assetPrefix":".","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><link rel="preload" href="./_next/static/css/2cf5163b53bb0adb.css" as="style"/><link rel="stylesheet" href="./_next/static/css/2cf5163b53bb0adb.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-77983e68be50f72a.js" defer=""></script><script src="./_next/static/chunks/743-fd706aeabb7828e3.js" defer=""></script><script src="./_next/static/chunks/pages/index-4f3646fa67414022.js" defer=""></script><script src="./_next/static/IC6xj1lLrrZr6c04YdiRW/_buildManifest.js" defer=""></script><script src="./_next/static/IC6xj1lLrrZr6c04YdiRW/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"IC6xj1lLrrZr6c04YdiRW","assetPrefix":".","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

resources/newssite/news-next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"react-dom": "18.2.0",
2121
"react-router-dom": "^6.11.1",
2222
"react-router-hash-link": "^2.4.3",
23-
"speedometer-utils": "link:../../shared",
23+
"speedometer-utils": "file:../../shared",
2424
"uuid": "^9.0.0"
2525
}
2626
}

resources/shared/benchmark.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ export class BenchmarkConnector {
133133

134134
async onMessage(event) {
135135
const message = event.data;
136-
if (message.appId !== this.appId || message.key !== "benchmark-connector")
136+
if (message.appId !== this.appId || message.key !== "benchmark-connector") {
137+
console.warning("Invalid message", message);
137138
return;
139+
}
138140

139141
switch (message.type) {
140142
case MESSAGE_TYPE.suiteStart:
@@ -165,7 +167,7 @@ export class BenchmarkConnector {
165167

166168
connect() {
167169
window.addEventListener("message", this.onMessage);
168-
this._sendMessage({ type: MESSAGE_TYPE.appReady });
170+
this._sendMessage(MESSAGE_TYPE.appReady, { appId: this.appId });
169171
}
170172

171173
disconnect() {

resources/suite-runner.mjs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,17 @@ export class RemoteSuiteRunner extends SuiteRunner {
160160
const suiteName = this.suite.name;
161161
const suitePrepareStartLabel = `suite-${suiteName}-prepare-start`;
162162
const suitePrepareEndLabel = `suite-${suiteName}-prepare-end`;
163-
164163
performance.mark(suitePrepareStartLabel);
165164

166165
// Wait for the app-ready message from the workload.
167166
const appReadyPromise = this._subscribeOnce(MESSAGE_TYPE.appReady);
168167
await this._loadFrame(this.suite);
168+
// The suite will send out the app-ready message.
169169
const response = await appReadyPromise;
170+
this._initializeAppId(response.appId);
170171
await this.suite.prepare?.(this.page);
171-
// Capture appId to pass along with messages.
172-
this.appId = response?.appId;
173172

174173
performance.mark(suitePrepareEndLabel);
175-
176174
const entry = performance.measure(`suite-${suiteName}-prepare`, suitePrepareStartLabel, suitePrepareEndLabel);
177175
this.#prepareTime = entry.duration;
178176
}
@@ -206,7 +204,8 @@ export class RemoteSuiteRunner extends SuiteRunner {
206204
}
207205

208206
_handlePostMessage(event) {
209-
const callback = this.postMessageCallbacks.get(event.data.type);
207+
const message = event.data;
208+
const callback = this.postMessageCallbacks.get(message.type);
210209
if (callback)
211210
callback(event);
212211
}
@@ -229,13 +228,19 @@ export class RemoteSuiteRunner extends SuiteRunner {
229228
return new Promise((resolve) => {
230229
this._startSubscription(type, (e) => {
231230
const message = e.data;
232-
if (message.appId !== this.appId)
233-
throw new Error(`Got message for invalid app: ${message.appId} instead of {this.appId}`);
231+
if (type !== MESSAGE_TYPE.appReady && message.appId !== this.appId)
232+
throw new Error(`Got message for invalid app: ${message.appId} instead of ${this.appId}`);
234233
this._stopSubscription(type);
235234
resolve(message.payload);
236235
});
237236
});
238237
}
238+
239+
_initializeAppId(appId) {
240+
console.assert(!this.appId, `Cannot receive ${MESSAGE_TYPE.appReady} twice`);
241+
console.assert(appId, `${MESSAGE_TYPE.appReady} sent no appId`);
242+
this.appId = appId;
243+
}
239244
}
240245

241246
export const SUITE_RUNNER_LOOKUP = {

resources/todomvc/vanilla-examples/javascript-web-components/dist/src/speedometer-utils/benchmark.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class AsyncBenchmarkStep extends BenchmarkStep {
2828
}
2929
}
3030

31-
export const BenchmarkSuiteType = Object.freeze({
31+
export const BENCHMARK_SUITE_TYPE = Object.freeze({
3232
__proto__: null,
3333
sync: "sync",
3434
async: "async",
@@ -40,11 +40,11 @@ export const BenchmarkSuiteType = Object.freeze({
4040
* A single test suite that contains one or more test steps.
4141
*/
4242
export class BenchmarkSuite {
43-
constructor(name, tests, type = BenchmarkSuiteType.sync) {
43+
constructor(name, tests, type = BENCHMARK_SUITE_TYPE.sync) {
4444
this.name = name;
4545
this.tests = tests;
4646
this.type = type;
47-
console.assert(this.type in BenchmarkSuiteType);
47+
console.assert(this.type in BENCHMARK_SUITE_TYPE);
4848
}
4949

5050
record(_test, syncTime, asyncTime) {
@@ -90,11 +90,10 @@ export class BenchmarkSuite {
9090

9191
export class AsyncBenchmarkSuite extends BenchmarkSuite {
9292
constructor(name, tests) {
93-
super(name, tests, BenchmarkSuiteType.async);
93+
super(name, tests, BENCHMARK_SUITE_TYPE.async);
9494
}
9595
}
9696

97-
9897
export const MESSAGE_TYPE = Object.freeze({
9998
__proto__: null,
10099
appReady: "app-ready",
@@ -109,7 +108,6 @@ export const MESSAGE_STATUS = Object.freeze({
109108
error: "error",
110109
});
111110

112-
113111
/** **********************************************************************
114112
* BenchmarkConnector
115113
*
@@ -135,8 +133,10 @@ export class BenchmarkConnector {
135133

136134
async onMessage(event) {
137135
const message = event.data;
138-
if (message.appId !== this.appId || message.key !== "benchmark-connector")
136+
if (message.appId !== this.appId || message.key !== "benchmark-connector") {
137+
console.warning("Invalid message", message);
139138
return;
139+
}
140140

141141
switch (message.type) {
142142
case MESSAGE_TYPE.suiteStart:
@@ -167,7 +167,7 @@ export class BenchmarkConnector {
167167

168168
connect() {
169169
window.addEventListener("message", this.onMessage);
170-
this._sendMessage({ type: MESSAGE_TYPE.appReady });
170+
this._sendMessage(MESSAGE_TYPE.appReady, { appId: this.appId });
171171
}
172172

173173
disconnect() {

tests/helper.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ export default async function testSetup(helpText) {
8888
await logInspector.onConsoleEntry((log) => {
8989
console.log(`${log.type}.${log.level}`.toUpperCase(), log.text);
9090
});
91+
await logInspector.onJavascriptException((log) => {
92+
console.log(log);
93+
});
9194
}
9295

9396
async function stop() {

0 commit comments

Comments
 (0)