test(browser): WebKit의 「preload를 몇 초 안에 안 썼다」 추측 경고를 받아들인다
WebKit은 load 이벤트 3초 뒤, 아직 쓰이지 않은 link preload마다 경고를 한 번 낸다. 공용 fixture는 경고를 실패로 센다. 그런데 desktop 호스트의 WebKit은 화면 하나를 여는 데 4초 안팎이 걸려, 곧 쓰일 청크에도 이 경고가 나온다. app-shell 시험이 3회 반복 중 한 번 이것으로 떨어졌다 (document-kind-labels-*.js). 템플릿(1103/11-09)과 같은 문장 정규식으로 이 경고만 무시한다. 한계: 템플릿은 이 추측 대신 「preload한 스크립트가 실제로 실행됐는지」를 모든 엔진에서 직접 검사한다(preload-use.ts, 시험 서버가 빌드 스크립트에 표시를 넣는다). 그 장치는 CSP·SW 시험의 응답 가로채기까지 같이 고쳐야 해서 옮기지 않았다. 그래서 쓰이지 않는 preload는 지금 어느 엔진에서도 잡히지 않는다. 다음 템플릿 동기화 때 옮길 일이다. 검증: app-shell을 포함한 다섯 시험을 세 엔진에서 3회 반복해 81건 통과.
This commit is contained in:
@@ -16,11 +16,22 @@ import {
|
||||
const FIREFOX_PRETENDARD_NAME_ORDER =
|
||||
/^\[JavaScript Warning: "downloadable font: name: name records are not sorted\. \(font-family: "Pretendard Variable" style:normal weight:45\.\.920 stretch:100 src index:0\) source: http:\/\/127\.0\.0\.1:\d+\/[\w./@-]*PretendardVariable(?:-[\w-]+)?\.woff2"\]$/u;
|
||||
|
||||
/**
|
||||
* Template 1103/11-09. WebKit's guess, three seconds after the load event,
|
||||
* that a preload went unused. It fires for chunks the page runs a moment
|
||||
* later, which on the desktop host is often (WebKit takes about 4 s to open a
|
||||
* page there). The template replaces it with a check of its own that every
|
||||
* preloaded script ran (preload-use.ts); that check is not ported yet.
|
||||
*/
|
||||
const WEBKIT_UNUSED_PRELOAD_GUESS =
|
||||
/^The resource \S+ was preloaded using link preload but not used within a few seconds from the window's load event\. Please make sure it wasn't preloaded for nothing\.$/u;
|
||||
|
||||
function ignoredConsole(message: ConsoleMessage) {
|
||||
return (
|
||||
message.type() === "warning" &&
|
||||
(message.text().includes("NO_COLOR") ||
|
||||
FIREFOX_PRETENDARD_NAME_ORDER.test(message.text()))
|
||||
FIREFOX_PRETENDARD_NAME_ORDER.test(message.text()) ||
|
||||
WEBKIT_UNUSED_PRELOAD_GUESS.test(message.text()))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user