mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 899348 - Dispatch an event when an out-of-process browser crashes and display an error page when that occurs. r=bz
This commit is contained in:
parent
1623103fc3
commit
cf77c1b0f9
@ -3118,6 +3118,22 @@
|
||||
tab.setAttribute("titlechanged", "true");
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="oop-browser-crashed">
|
||||
<![CDATA[
|
||||
if (!event.isTrusted)
|
||||
return;
|
||||
|
||||
let browser = event.originalTarget;
|
||||
let title = browser.contentTitle;
|
||||
let uri = browser.currentURI;
|
||||
|
||||
this._updateBrowserRemoteness(browser, false);
|
||||
|
||||
browser.setAttribute("crashedPageTitle", title);
|
||||
browser.docShell.displayLoadError(Cr.NS_ERROR_CONTENT_CRASHED, uri, null);
|
||||
browser.removeAttribute("crashedPageTitle");
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -3982,7 +3982,7 @@ bool
|
||||
nsDocShell::IsPrintingOrPP(bool aDisplayErrorDialog)
|
||||
{
|
||||
if (mIsPrintingOrPP && aDisplayErrorDialog) {
|
||||
DisplayLoadError(NS_ERROR_DOCUMENT_IS_PRINTMODE, nullptr, nullptr);
|
||||
DisplayLoadError(NS_ERROR_DOCUMENT_IS_PRINTMODE, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
return mIsPrintingOrPP;
|
||||
@ -4138,7 +4138,7 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
|
||||
// what happens
|
||||
|
||||
if (NS_ERROR_MALFORMED_URI == rv) {
|
||||
DisplayLoadError(rv, uri, aURI);
|
||||
DisplayLoadError(rv, uri, aURI, nullptr);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !uri)
|
||||
@ -4353,6 +4353,15 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
bucketId);
|
||||
|
||||
cssClass.AssignLiteral("blacklist");
|
||||
} else if (NS_ERROR_CONTENT_CRASHED == aError) {
|
||||
errorPage.AssignLiteral("tabcrashed");
|
||||
error.AssignLiteral("tabcrashed");
|
||||
|
||||
nsCOMPtr<EventTarget> handler = mChromeEventHandler;
|
||||
if (handler) {
|
||||
nsCOMPtr<Element> element = do_QueryInterface(handler);
|
||||
element->GetAttribute(NS_LITERAL_STRING("crashedPageTitle"), messageStr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Errors requiring simple formatting
|
||||
|
@ -520,9 +520,6 @@ protected:
|
||||
nsresult EnsureTransferableHookData();
|
||||
NS_IMETHOD EnsureFind();
|
||||
nsresult RefreshURIFromQueue();
|
||||
NS_IMETHOD DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
const PRUnichar *aURL,
|
||||
nsIChannel* aFailedChannel = nullptr);
|
||||
NS_IMETHOD LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
||||
const char *aErrorPage,
|
||||
const PRUnichar *aErrorType,
|
||||
|
@ -42,7 +42,7 @@ interface nsIVariant;
|
||||
interface nsIPrivacyTransitionObserver;
|
||||
interface nsIReflowObserver;
|
||||
|
||||
[scriptable, builtinclass, uuid(4bb2261b-4c13-44a4-ace3-fc2eec17cc34)]
|
||||
[scriptable, builtinclass, uuid(62f1b40d-1d15-4640-95dc-20caae775bd1)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
@ -411,6 +411,22 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
/* attribute to access whether error pages are enabled */
|
||||
attribute boolean useErrorPages;
|
||||
|
||||
/**
|
||||
* Display a load error in a frame while keeping that frame's currentURI
|
||||
* pointing correctly to the page where the error ocurred, rather than to
|
||||
* the error document page. You must provide either the aURI or aURL parameter.
|
||||
*
|
||||
* @param aError The error code to be displayed
|
||||
* @param aURI nsIURI of the page where the error happened
|
||||
* @param aURL wstring of the page where the error happened
|
||||
* @param aFailedChannel The channel related to this error
|
||||
*/
|
||||
void displayLoadError(in nsresult aError,
|
||||
in nsIURI aURI,
|
||||
in wstring aURL,
|
||||
[optional] in nsIChannel aFailedChannel);
|
||||
|
||||
|
||||
/**
|
||||
* Keeps track of the previous SHTransaction index and the current
|
||||
* SHTransaction index at the time that the doc shell begins to load.
|
||||
|
@ -297,12 +297,16 @@ TabParent::ActorDestroy(ActorDestroyReason why)
|
||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (frameLoader) {
|
||||
nsCOMPtr<Element> frameElement(mFrameElement);
|
||||
ReceiveMessage(CHILD_PROCESS_SHUTDOWN_MESSAGE, false, nullptr, nullptr);
|
||||
frameLoader->DestroyChild();
|
||||
|
||||
if (why == AbnormalShutdown && os) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, frameLoader),
|
||||
"oop-frameloader-crashed", nullptr);
|
||||
nsContentUtils::DispatchTrustedEvent(frameElement->OwnerDoc(), frameElement,
|
||||
NS_LITERAL_STRING("oop-browser-crashed"),
|
||||
true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,3 +33,5 @@ phishingBlocked=The website at %S has been reported as a web forgery designed to
|
||||
cspFrameAncestorBlocked=This page has a content security policy that prevents it from being embedded in this way.
|
||||
corruptedContentError=The page you are trying to view cannot be shown because an error in the data transmission was detected.
|
||||
remoteXUL=This page uses an unsupported technology that is no longer available by default.
|
||||
#LOCALIZATION NOTE (tabcrashed): The following string is shown in the tab title if a page with a blank title has crashed. Current UX says that the tab title should remain blank
|
||||
tabcrashed=
|
||||
|
@ -209,3 +209,7 @@ XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_ENDDOC , "Printing failed while c
|
||||
XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_STARTPAGE , "Printing failed while starting a new page.")
|
||||
XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY , "Cannot print this document yet, it is still being loaded.")
|
||||
XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_NO_XUL , "Printing XUL documents is not supported.") // bugs 136185 & 240490
|
||||
|
||||
/* Codes related to content */
|
||||
XPC_MSG_DEF(NS_ERROR_CONTENT_CRASHED , "The process that hosted this content has crashed.")
|
||||
|
||||
|
@ -687,6 +687,8 @@
|
||||
ERROR(NS_PROPTABLE_PROP_NOT_THERE, FAILURE(10)),
|
||||
/* Error code for XBL */
|
||||
ERROR(NS_ERROR_XBL_BLOCKED, FAILURE(15)),
|
||||
/* Error code for when the content process crashed */
|
||||
ERROR(NS_ERROR_CONTENT_CRASHED, FAILURE(16)),
|
||||
|
||||
/* XXX this is not really used */
|
||||
ERROR(NS_HTML_STYLE_PROPERTY_NOT_THERE, SUCCESS(2)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user