mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 22:37:50 +00:00
Bug 913155 - Electrolysis: Add a submit crashreport box on the tab crashed page. r=felipe,smaug
This commit is contained in:
parent
503b097db2
commit
c788b73314
@ -15,6 +15,8 @@
|
||||
<!ENTITY % browserDTD
|
||||
SYSTEM "chrome://browser/locale/browser.dtd">
|
||||
%browserDTD;
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
|
||||
]>
|
||||
|
||||
@ -30,6 +32,11 @@
|
||||
<p id="helper-error-msg">&tabCrashed.message;</p>
|
||||
</div>
|
||||
|
||||
<div id="report-box">
|
||||
<input type="checkbox" id="checkSendReport" checked="checked"/>
|
||||
<label for="checkSendReport">&tabCrashed.checkSendReport;</label>
|
||||
</div>
|
||||
|
||||
<div id="button-box">
|
||||
<button id="tryAgain">&tabCrashed.tryAgain;</button>
|
||||
</div>
|
||||
|
@ -137,6 +137,11 @@ XPCOMUtils.defineLazyModuleGetter(this, "SitePermissions",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm");
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TabCrashReporter",
|
||||
"resource:///modules/TabCrashReporter.jsm");
|
||||
#endif
|
||||
|
||||
let gInitialPages = [
|
||||
"about:blank",
|
||||
"about:newtab",
|
||||
@ -1042,6 +1047,11 @@ var gBrowserInit = {
|
||||
// Ensure login manager is up and running.
|
||||
Services.logins;
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (gMultiProcessBrowser)
|
||||
TabCrashReporter.init();
|
||||
#endif
|
||||
|
||||
if (mustLoadSidebar) {
|
||||
let sidebar = document.getElementById("sidebar");
|
||||
let sidebarBox = document.getElementById("sidebar-box");
|
||||
@ -2497,6 +2507,12 @@ let BrowserOnClick = {
|
||||
|
||||
let button = aEvent.originalTarget;
|
||||
if (button.id == "tryAgain") {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (aOwnerDoc.getElementById("checkSendReport").checked) {
|
||||
let browser = gBrowser.getBrowserForDocument(aOwnerDoc);
|
||||
TabCrashReporter.submitCrashReport(browser);
|
||||
}
|
||||
#endif
|
||||
openUILinkIn(button.getAttribute("url"), "current");
|
||||
}
|
||||
},
|
||||
@ -4267,6 +4283,11 @@ var TabsProgressListener = {
|
||||
if (event.target.documentElement)
|
||||
event.target.documentElement.removeAttribute("hasBrowserHandlers");
|
||||
}, true);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (doc.documentURI.startsWith("about:tabcrashed"))
|
||||
TabCrashReporter.onAboutTabCrashedLoad(aBrowser);
|
||||
#endif
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -48,8 +48,7 @@ if (Services.prefs.getBoolPref("browser.tabs.remote")) {
|
||||
|
||||
let AboutHomeListener = {
|
||||
init: function(chromeGlobal) {
|
||||
let self = this;
|
||||
chromeGlobal.addEventListener('AboutHomeLoad', function(e) { self.onPageLoad(); }, false, true);
|
||||
chromeGlobal.addEventListener('AboutHomeLoad', () => this.onPageLoad(), false, true);
|
||||
},
|
||||
|
||||
handleEvent: function(aEvent) {
|
||||
|
@ -673,6 +673,7 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
||||
|
||||
<!ENTITY tabCrashed.header "Tab crashed">
|
||||
<!ENTITY tabCrashed.message "Well, this is embarrassing. We tried to display this Web page, but it's not responding.">
|
||||
<!ENTITY tabCrashed.checkSendReport "Tell &vendorShortName; about this crash so they can fix it.">
|
||||
<!ENTITY tabCrashed.tryAgain "Try Again">
|
||||
|
||||
<!-- LOCALIZATION NOTE: the following strings are unused in Australis, they're
|
||||
|
73
browser/modules/TabCrashReporter.jsm
Normal file
73
browser/modules/TabCrashReporter.jsm
Normal file
@ -0,0 +1,73 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
let Cc = Components.classes;
|
||||
let Ci = Components.interfaces;
|
||||
let Cu = Components.utils;
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "TabCrashReporter" ];
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
|
||||
"resource://gre/modules/CrashSubmit.jsm");
|
||||
|
||||
this.TabCrashReporter = {
|
||||
init: function () {
|
||||
if (this.initialized)
|
||||
return;
|
||||
this.initialized = true;
|
||||
|
||||
Services.obs.addObserver(this, "ipc:content-shutdown", false);
|
||||
Services.obs.addObserver(this, "oop-frameloader-crashed", false);
|
||||
|
||||
this.childMap = new Map();
|
||||
this.browserMap = new WeakMap();
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "ipc:content-shutdown":
|
||||
aSubject.QueryInterface(Ci.nsIPropertyBag2);
|
||||
|
||||
if (!aSubject.get("abnormal"))
|
||||
return;
|
||||
|
||||
this.childMap.set(aSubject.get("childID"), aSubject.get("dumpID"));
|
||||
break;
|
||||
|
||||
case "oop-frameloader-crashed":
|
||||
aSubject.QueryInterface(Ci.nsIFrameLoader);
|
||||
|
||||
let browser = aSubject.ownerElement;
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
this.browserMap.set(browser, aSubject.childID);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
submitCrashReport: function (aBrowser) {
|
||||
let childID = this.browserMap.get(aBrowser);
|
||||
let dumpID = this.childMap.get(childID);
|
||||
if (!dumpID)
|
||||
return
|
||||
|
||||
if (CrashSubmit.submit(dumpID)) {
|
||||
this.childMap.set(childID, null); // Avoid resubmission.
|
||||
}
|
||||
},
|
||||
|
||||
onAboutTabCrashedLoad: function (aBrowser) {
|
||||
let dumpID = this.childMap.get(this.browserMap.get(aBrowser));
|
||||
if (!dumpID)
|
||||
return;
|
||||
|
||||
aBrowser.contentDocument.documentElement.classList.add("crashDumpAvaible");
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ EXTRA_JS_MODULES += [
|
||||
'SignInToWebsite.jsm',
|
||||
'SitePermissions.jsm',
|
||||
'Social.jsm',
|
||||
'TabCrashReporter.jsm',
|
||||
'offlineAppCache.jsm',
|
||||
'openLocationLastURL.jsm',
|
||||
'webappsUI.jsm',
|
||||
|
@ -23,6 +23,16 @@ p {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#report-box {
|
||||
text-align: center;
|
||||
width: 75%;
|
||||
margin: 0 auto;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.crashDumpAvaible #report-box {
|
||||
display: block
|
||||
}
|
||||
|
||||
#button-box {
|
||||
text-align: center;
|
||||
|
@ -23,6 +23,16 @@ p {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#report-box {
|
||||
text-align: center;
|
||||
width: 75%;
|
||||
margin: 0 auto;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.crashDumpAvaible #report-box {
|
||||
display: block
|
||||
}
|
||||
|
||||
#button-box {
|
||||
text-align: center;
|
||||
|
@ -23,6 +23,16 @@ p {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#report-box {
|
||||
text-align: center;
|
||||
width: 75%;
|
||||
margin: 0 auto;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.crashDumpAvaible #report-box {
|
||||
display: block
|
||||
}
|
||||
|
||||
#button-box {
|
||||
text-align: center;
|
||||
|
@ -111,7 +111,7 @@ interface nsIContentViewManager : nsISupports
|
||||
readonly attribute nsIContentView rootContentView;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(e4333e51-f2fa-4fdd-becd-75d000703355)]
|
||||
[scriptable, builtinclass, uuid(5b9949dc-56f1-47b6-b6d2-3785bb90ed6d)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -257,6 +257,13 @@ interface nsIFrameLoader : nsISupports
|
||||
*/
|
||||
readonly attribute nsIDOMElement ownerElement;
|
||||
|
||||
|
||||
/**
|
||||
* Cached childID of the ContentParent owning the TabParent in this frame
|
||||
* loader. This can be used to obtain the childID after the TabParent died.
|
||||
*/
|
||||
readonly attribute unsigned long long childID;
|
||||
|
||||
/**
|
||||
* Get or set this frame loader's visibility.
|
||||
*
|
||||
|
@ -288,6 +288,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
|
||||
, mVisible(true)
|
||||
, mCurrentRemoteFrame(nullptr)
|
||||
, mRemoteBrowser(nullptr)
|
||||
, mChildID(0)
|
||||
, mRenderMode(RENDER_MODE_DEFAULT)
|
||||
, mEventMode(EVENT_MODE_NORMAL_DISPATCH)
|
||||
{
|
||||
@ -2061,6 +2062,7 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
||||
mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement);
|
||||
if (mRemoteBrowser) {
|
||||
mChildID = mRemoteBrowser->Manager()->ChildID();
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
parentAsItem->GetRootTreeItem(getter_AddRefs(rootItem));
|
||||
nsCOMPtr<nsIDOMWindow> rootWin = do_GetInterface(rootItem);
|
||||
@ -2444,6 +2446,13 @@ nsFrameLoader::GetOwnerElement(nsIDOMElement **aElement)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetChildID(uint64_t* aChildID)
|
||||
{
|
||||
*aChildID = mChildID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
|
||||
{
|
||||
@ -2451,7 +2460,7 @@ nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
|
||||
MOZ_ASSERT(!mCurrentRemoteFrame);
|
||||
mRemoteFrame = true;
|
||||
mRemoteBrowser = static_cast<TabParent*>(aTabParent);
|
||||
|
||||
mChildID = mRemoteBrowser ? mRemoteBrowser->Manager()->ChildID() : 0;
|
||||
ShowRemoteFrame(nsIntSize(0, 0));
|
||||
}
|
||||
|
||||
|
@ -442,6 +442,7 @@ private:
|
||||
nsRefPtr<mozilla::dom::ContentParent> mContentParent;
|
||||
RenderFrameParent* mCurrentRemoteFrame;
|
||||
TabParent* mRemoteBrowser;
|
||||
uint64_t mChildID;
|
||||
|
||||
// See nsIFrameLoader.idl. Short story, if !(mRenderMode &
|
||||
// RENDER_MODE_ASYNC_SCROLL), all the fields below are ignored in
|
||||
|
Loading…
x
Reference in New Issue
Block a user