Bug 1540170 - don't use history for windowless browsers, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D25587

--HG--
extra : rebase_source : ec367a840c573caa5eadc8332e4137023d735c35
This commit is contained in:
Gijs Kruitbosch 2019-04-01 11:59:40 +01:00
parent c6d20be462
commit 750ee88f29
3 changed files with 7 additions and 4 deletions

View File

@ -102,7 +102,8 @@ nsIWidget* nsWebBrowser::EnsureWidget() {
already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
nsIWebBrowserChrome* aContainerWindow, nsIWidget* aParentWidget,
const OriginAttributes& aOriginAttributes,
dom::BrowsingContext* aBrowsingContext) {
dom::BrowsingContext* aBrowsingContext,
bool aDisableHistory /* = false */) {
RefPtr<nsWebBrowser> browser = new nsWebBrowser(
aBrowsingContext->IsContent() ? typeContentWrapper : typeChromeWrapper);
@ -152,7 +153,7 @@ already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
docShell->InitSessionHistory();
if (XRE_IsParentProcess()) {
if (XRE_IsParentProcess() && !aDisableHistory) {
// Hook up global history. Do not fail if we can't - just warn.
DebugOnly<nsresult> rv =
browser->EnableGlobalHistory(browser->mShouldEnableHistory);

View File

@ -108,7 +108,8 @@ class nsWebBrowser final : public nsIWebBrowser,
static already_AddRefed<nsWebBrowser> Create(
nsIWebBrowserChrome* aContainerWindow, nsIWidget* aParentWidget,
const mozilla::OriginAttributes& aOriginAttributes,
mozilla::dom::BrowsingContext* aBrowsingContext);
mozilla::dom::BrowsingContext* aBrowsingContext,
bool aDisableHistory = false);
protected:
virtual ~nsWebBrowser();

View File

@ -495,7 +495,8 @@ nsAppShellService::CreateWindowlessBrowser(bool aIsChrome,
* an associated doc shell, which is what we're interested in.
*/
nsCOMPtr<nsIWebBrowser> browser =
nsWebBrowser::Create(stub, widget, OriginAttributes(), browsingContext);
nsWebBrowser::Create(stub, widget, OriginAttributes(), browsingContext,
true /* disable history */);
if (NS_WARN_IF(!browser)) {
NS_ERROR("Couldn't create instance of nsWebBrowser!");