fix: make sure invalid URL loads promises are fulfilled. #41194
Merged
trop / Backportable? - 29-x-y
completed
Feb 1, 2024 in 8h 32m 3s
Backport Failed
This PR was checked and could not be automatically backported to "29-x-y" cleanly
Details
Failed Diff:
diff --cc lib/browser/api/web-contents.ts
index 19660d3cf9,8dc7fc186d..0000000000
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@@ -347,13 -360,12 +347,16 @@@ WebContents.prototype.loadURL = functio
reject(err);
};
const finishListener = () => {
- if (error) {
- rejectAndCleanup(error);
- } else {
- resolveAndCleanup();
+ resolveAndCleanup();
+ };
++<<<<<<< HEAD
+ const failListener = (event: Electron.Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
+ if (isMainFrame) {
+ rejectAndCleanup(errorCode, errorDescription, validatedURL);
}
};
++=======
++>>>>>>> fix: make sure invalid URL loads promisses are fulfilled.
let navigationStarted = false;
let browserInitiatedInPageNavigation = false;
diff --cc spec/api-web-contents-spec.ts
index f339bad212,4f6185dd4c..0000000000
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@@ -514,6 -514,15 +514,18 @@@ describe('webContents module', () =>
.and.have.property('errno', -355); // ERR_INCOMPLETE_CHUNKED_ENCODING
s.close();
});
++<<<<<<< HEAD
++=======
+
+ it('subsequent load failures reject each time', async () => {
+ await expect(w.loadURL('file:non-existent')).to.eventually.be.rejected();
+ await expect(w.loadURL('file:non-existent')).to.eventually.be.rejected();
+ });
+
+ it('invalid URL load rejects', async () => {
+ await expect(w.loadURL('invalidURL')).to.eventually.be.rejected();
+ });
++>>>>>>> fix: make sure invalid URL loads promisses are fulfilled.
});
describe('getFocusedWebContents() API', () => {
Annotations
Check failure on line 360 in lib/browser/api/web-contents.ts
trop / Backportable? - 29-x-y
lib/browser/api/web-contents.ts#L356-L360
Patch Conflict
Raw output
++<<<<<<< HEAD
+ const failListener = (event: Electron.Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
+ if (isMainFrame) {
+ rejectAndCleanup(errorCode, errorDescription, validatedURL);
}
};
++=======
++>>>>>>> fix: make sure invalid URL loads promisses are fulfilled.
Check failure on line 360 in lib/browser/api/web-contents.ts
trop / Backportable? - 29-x-y
lib/browser/api/web-contents.ts#L356-L360
Patch Conflict
Raw output
++<<<<<<< HEAD
+ const failListener = (event: Electron.Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
+ if (isMainFrame) {
+ rejectAndCleanup(errorCode, errorDescription, validatedURL);
}
};
++=======
++>>>>>>> fix: make sure invalid URL loads promisses are fulfilled.