Bug 1043110 - Part 2 - dispatch mozbrowsererror. r=kanru

This commit is contained in:
Junior Hsu 2015-07-15 18:13:16 +08:00
parent 6c768db7c2
commit 4376bd27f7
2 changed files with 9 additions and 1 deletions

View File

@ -10423,6 +10423,10 @@ nsDocShell::DoURILoad(nsIURI* aURI,
// Here we prevent navigating to an app or widget which loses its validity
// by loading invalid page or other way.
if (browserFrame && !browserFrame->GetReallyIsApp()) {
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
if (serv) {
serv->NotifyObservers(GetDocument(), "invalid-widget", nullptr);
}
return NS_ERROR_MALFORMED_URI;
}
}

View File

@ -56,7 +56,8 @@ let CERTIFICATE_ERROR_PAGE_PREF = 'security.alternate_certificate_error_page';
const OBSERVED_EVENTS = [
'xpcom-shutdown',
'media-playback',
'activity-done'
'activity-done',
'invalid-widget'
];
const COMMAND_MAP = {
@ -300,6 +301,9 @@ BrowserElementChild.prototype = {
case 'xpcom-shutdown':
this._shuttingDown = true;
break;
case 'invalid-widget':
sendAsyncMsg('error', { type: 'invalid-widget' });
break;
}
},