https://pernos.co/debug/KfCtJSinpRnAHvlBWDb92g/index.html I think this JS stack from `createContentWindow` to setting `openWindowInfo` is relevant: ``` 0 createPreviewBrowser(sourceVersion = ""source"") ["chrome://global/content/printUtils.js":767:7] this = [object XULElement] 1 createParentBrowserForStaticClone(aBrowsingContext = "[object CanonicalBrowsingContext]", aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]") ["chrome://global/content/printUtils.js":412:32] this = [object Object] 2 handleStaticCloneCreatedForPrint(aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]") ["chrome://global/content/printUtils.js":399:17] this = [object Object] 3 getContentWindowOrOpenURI(aURI = "null", aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]", aWhere = "4", aFlags = "0", aTriggeringPrincipal = "[xpconnect wrapped nsIPrincipal @ 0x7006bf636b80 (native @ 0x7006b392d380)]", aCsp = "null", aSkipLoad = "true") ["chrome://messenger/content/mailWindow.js":841:20] this = [object Object] 4 createContentWindow(aURI = "null", aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]", aWhere = "4", aFlags = "0", aTriggeringPrincipal = "[xpconnect wrapped nsIPrincipal @ 0x7006bf636b80 (native @ 0x7006b392d380)]", aCsp = "null") ["chrome://messenger/content/mailWindow.js":776:17] this = [object Object] 5 anonymous() ["chrome://messenger/content/about3Pane.js":7498:53] 6 AsyncFunctionNext(val = "undefined") ["self-hosted":780:27] this = [object Object] ``` From a first look: - `PrintUtils.createParentBrowserForStaticClone` creates a browser with no `src`, we load an initial `about:blank`. This is a system context, we use a system principal as trigger. But it's a remote content browser, so `nsDocShellLoadState::SetupInheritingPrincipal` uses a new null principal for the document. This effectively means we don't want principal inheritance. - But we create the initial `about:blank` eagerly when creating the docshell. And there, `nsFrameLoader::mOpenWindowInfo` provides a content principal to be used. So once the load occurs, we'll hit an assert. - This `nsIOpenWindowInfo` comes from `nsWindowWatcher::OpenWindowInternal` and uses `nsContentUtils::SubjectPrincipal()` as principal to inherit. In Firefox, this subject principal would also be used as triggering principal later when `nsWindowWatcher` calls `LoadURI`. But ThunderBird has it's own `nsIWindowProvider` which somehow calls into `PrintUtils` and triggers the load before `nsWindowWatcher`. We should probably assert somewhere that the triggering principal matches `mOpenWindowInfo`. Either in `ReallyStartLoadingInternal` or `nsFrameLoader::LoadURI`. But what is the correct principal here? And could the print preview avoid the `about:blank` load?
Bug 2009681 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
https://pernos.co/debug/KfCtJSinpRnAHvlBWDb92g/index.html I think this JS stack from `createContentWindow` to setting `openWindowInfo` is relevant: ``` 0 createPreviewBrowser(sourceVersion = ""source"") ["chrome://global/content/printUtils.js":767:7] this = [object XULElement] 1 createParentBrowserForStaticClone(aBrowsingContext = "[object CanonicalBrowsingContext]", aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]") ["chrome://global/content/printUtils.js":412:32] this = [object Object] 2 handleStaticCloneCreatedForPrint(aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]") ["chrome://global/content/printUtils.js":399:17] this = [object Object] 3 getContentWindowOrOpenURI(aURI = "null", aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]", aWhere = "4", aFlags = "0", aTriggeringPrincipal = "[xpconnect wrapped nsIPrincipal @ 0x7006bf636b80 (native @ 0x7006b392d380)]", aCsp = "null", aSkipLoad = "true") ["chrome://messenger/content/mailWindow.js":841:20] this = [object Object] 4 createContentWindow(aURI = "null", aOpenWindowInfo = "[xpconnect wrapped nsIOpenWindowInfo @ 0x7006bf636b20 (native @ 0x7006e36b5fa0)]", aWhere = "4", aFlags = "0", aTriggeringPrincipal = "[xpconnect wrapped nsIPrincipal @ 0x7006bf636b80 (native @ 0x7006b392d380)]", aCsp = "null") ["chrome://messenger/content/mailWindow.js":776:17] this = [object Object] 5 anonymous() ["chrome://messenger/content/about3Pane.js":7498:53] 6 AsyncFunctionNext(val = "undefined") ["self-hosted":780:27] this = [object Object] ``` From a first look: - `PrintUtils.createParentBrowserForStaticClone` creates a browser with no `src`, we load an initial `about:blank`. This is a system context, we use a system principal as trigger. But it's a content browser, so `nsDocShellLoadState::SetupInheritingPrincipal` uses a new null principal for the document. This effectively means we don't want principal inheritance. - But we create the initial `about:blank` eagerly when creating the docshell. And there, `nsFrameLoader::mOpenWindowInfo` provides a content principal to be used. So once the load occurs, we'll hit an assert. - This `nsIOpenWindowInfo` comes from `nsWindowWatcher::OpenWindowInternal` and uses `nsContentUtils::SubjectPrincipal()` as principal to inherit. In Firefox, this subject principal would also be used as triggering principal later when `nsWindowWatcher` calls `LoadURI`. But ThunderBird has it's own `nsIWindowProvider` which somehow calls into `PrintUtils` and triggers the load before `nsWindowWatcher`. We should probably assert somewhere that the triggering principal matches `mOpenWindowInfo`. Either in `ReallyStartLoadingInternal` or `nsFrameLoader::LoadURI`. But what is the correct principal here? And could the print preview avoid the `about:blank` load?