Bug 1999189 - Add document filename to navigateerror event. r=avandolder,smaug
Differential Revision: https://phabricator.services.mozilla.com/D271922
This commit is contained in:
committed by
afarre@mozilla.com
parent
50f5ff07bf
commit
55c3ab7cd6
@@ -116,6 +116,8 @@ class NavigateEvent final : public Event {
|
||||
|
||||
void PerformSharedChecks(ErrorResult& aRv);
|
||||
|
||||
Document* GetAssociatedDocument() const;
|
||||
|
||||
private:
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
void PotentiallyResetFocus();
|
||||
@@ -126,8 +128,6 @@ class NavigateEvent final : public Event {
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
void ProcessScrollBehavior();
|
||||
|
||||
Document* GetAssociatedDocument() const;
|
||||
|
||||
explicit NavigateEvent(EventTarget* aOwner);
|
||||
~NavigateEvent();
|
||||
|
||||
|
||||
@@ -1139,13 +1139,27 @@ nsresult Navigation::FireEvent(const nsAString& aName) {
|
||||
|
||||
static void ExtractErrorInformation(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aError,
|
||||
ErrorEventInit& aErrorEventInitDict) {
|
||||
ErrorEventInit& aErrorEventInitDict,
|
||||
NavigateEvent* aEvent) {
|
||||
nsContentUtils::ExtractErrorValues(
|
||||
aCx, aError, aErrorEventInitDict.mFilename, &aErrorEventInitDict.mLineno,
|
||||
&aErrorEventInitDict.mColno, aErrorEventInitDict.mMessage);
|
||||
aErrorEventInitDict.mError = aError;
|
||||
aErrorEventInitDict.mBubbles = false;
|
||||
aErrorEventInitDict.mCancelable = false;
|
||||
|
||||
if (!aErrorEventInitDict.mFilename.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr document = aEvent->GetAssociatedDocument();
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto* uri = document->GetDocumentURI()) {
|
||||
uri->GetSpec(aErrorEventInitDict.mFilename);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult Navigation::FireErrorEvent(const nsAString& aName,
|
||||
@@ -1832,7 +1846,7 @@ void Navigation::AbortNavigateEvent(
|
||||
|
||||
// 3. Let errorInfo be the result of extracting error information from reason.
|
||||
RootedDictionary<ErrorEventInit> init(aCx);
|
||||
ExtractErrorInformation(aCx, aReason, init);
|
||||
ExtractErrorInformation(aCx, aReason, init, aEvent);
|
||||
|
||||
// 4. Set navigation's ongoing navigate event to null.
|
||||
mOngoingNavigateEvent = nullptr;
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
[navigation-back-same-document-preventDefault.html]
|
||||
[navigation.back() same-document preventDefault]
|
||||
expected: FAIL
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
[navigation-traverseTo-in-iframe-same-document-preventDefault.html]
|
||||
expected: TIMEOUT
|
||||
[navigation.traverseTo() in an iframe with same-document preventDefault in its parent]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
[traverseTo-navigates-multiple-iframes.html]
|
||||
expected: [TIMEOUT, OK]
|
||||
[entries() should be correct after a traversal that navigates multiple browsing contexts]
|
||||
expected: [TIMEOUT, FAIL]
|
||||
expected: FAIL
|
||||
|
||||
Reference in New Issue
Block a user