Bug 1027461 - Handle an error condition in imports more gracefully in debug builds.

This commit is contained in:
Blake Kaplan 2014-07-01 10:50:47 -07:00
Родитель 8ae5359acd
Коммит b0e55c813b
4 изменённых файлов: 25 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="import" href="1027461-inner.xul">
</head>
<body>
</body>
</html>

Просмотреть файл

@ -0,0 +1,2 @@
<?xml?>
<empty-xul-file />

Просмотреть файл

@ -150,3 +150,4 @@ load 930250.html
load 942979.html
load 978646.html
load 1026714.html
pref(dom.webcomponents.enabled,true) load 1027461-1.html

Просмотреть файл

@ -273,6 +273,15 @@ ImportLoader::OnStopRequest(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aStatus)
{
// OnStartRequest throws a special error code to let us know that we
// shouldn't do anything else.
if (aStatus == NS_ERROR_DOM_ABORT_ERR) {
// We failed in OnStartRequest, nothing more to do (we've already
// dispatched an error event) just return here.
MOZ_ASSERT(!mChannel);
return NS_OK;
}
MOZ_ASSERT(aRequest == mChannel,
"Wrong channel something went horribly wrong");
@ -303,7 +312,7 @@ ImportLoader::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
mChannel->GetContentType(type);
if (!type.EqualsLiteral("text/html")) {
NS_WARNING("ImportLoader wrong content type");
return NS_ERROR_FAILURE;
return NS_ERROR_DOM_ABORT_ERR;
}
// The scope object is same for all the imports in an import tree,
@ -316,7 +325,7 @@ ImportLoader::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
emptyStr, emptyStr, nullptr, mURI,
baseURI, principal, false, global,
DocumentFlavorHTML);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR);
// The imported document must know which master document it belongs to.
mDocument = do_QueryInterface(importDoc);
@ -330,12 +339,12 @@ ImportLoader::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
rv = mDocument->StartDocumentLoad("import", mChannel, loadGroup,
nullptr, getter_AddRefs(listener),
true);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR);
// Let's start parser.
mParserStreamListener = listener;
rv = listener->OnStartRequest(aRequest, aContext);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR);
ae.Pass();
return NS_OK;