Skip to content

Commit 942f3f9

Browse files
committed
Move URL/history updating out of respondWith()
This ensures that if multiple event handlers are in place, appHistory.current and location.href only update after they all have finished. Part of #94.
1 parent e2d9f6b commit 942f3f9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spec.bs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,6 @@ An {{AppHistoryNavigateEvent}} also has an associated {{Promise}}-or-null <dfn f
423423
1. If [=this=]'s [=Event/canceled flag=] is set, then throw an "{{InvalidStateError}}" {{DOMException}}.
424424
1. Set [=this=]'s [=Event/canceled flag=].
425425
1. Set [=this=]'s [=AppHistoryNavigateEvent/navigation action promise=] to |newNavigationAction|.
426-
1. If [=this=]'s {{AppHistoryNavigateEvent/navigationType}} attribute was initialized to "{{AppHistoryNavigationType/push}}" or "{{AppHistoryNavigationType/replace}}":
427-
1. Let |isPush| be true if [=this=]'s {{AppHistoryNavigateEvent/navigationType}} attribute was initialized to "{{AppHistoryNavigationType/push}}"; otherwise, false.
428-
1. Run the <a spec="HTML">URL and history update steps</a> given [=this=]'s [=relevant global object=]'s [=associated document=] and [=this=]'s [=AppHistoryNavigateEvent/destination URL=], with <i>[=URL and history update steps/serializedData=]</i> set to [=this=]'s [=AppHistoryNavigateEvent/classic history API serialized data=] and <i>[=URL and history update steps/isPush=]</i> set to |isPush|.
429-
1. Otherwise:
430-
1. <a spec="HTML">Traverse the history</a> of [=this=]'s [=relevant global object=]'s [=Window/browsing context=] to [=AppHistoryNavigateEvent/destination entry=].
431426
</div>
432427

433428
<hr>
@@ -464,6 +459,12 @@ An {{AppHistoryNavigateEvent}} also has an associated {{Promise}}-or-null <dfn f
464459
1. Let |result| be the result of [=dispatching=] |event| at |appHistory|.
465460
1. If [=this=]'s [=relevant global object=]'s [=Window/browsing context=] is null, then return false.
466461
<p class="note">This can occurr if an event listener disconnected the <{iframe}> corresponding to [=this=]'s [=relevant global object=].</p>
462+
1. If |event|'s [=AppHistoryNavigateEvent/navigation action promise=] is non-null, then:
463+
1. If |event|'s {{AppHistoryNavigateEvent/navigationType}} attribute was initialized to "{{AppHistoryNavigationType/push}}" or "{{AppHistoryNavigationType/replace}}":
464+
1. Let |isPush| be true if |event|'s {{AppHistoryNavigateEvent/navigationType}} attribute was initialized to "{{AppHistoryNavigationType/push}}"; otherwise, false.
465+
1. Run the <a spec="HTML">URL and history update steps</a> given |event|'s [=relevant global object=]'s [=associated document=] and |event|'s [=AppHistoryNavigateEvent/destination URL=], with <i>[=URL and history update steps/serializedData=]</i> set to |event|'s [=AppHistoryNavigateEvent/classic history API serialized data=] and <i>[=URL and history update steps/isPush=]</i> set to |isPush|.
466+
1. Otherwise:
467+
1. <a spec="HTML">Traverse the history</a> of |event|'s [=relevant global object=]'s [=Window/browsing context=] to [=AppHistoryNavigateEvent/destination entry=].
467468
1. If |event|'s [=AppHistoryNavigateEvent/navigation action promise=] is non-null, or both |result| and |isSameDocument| are true, then:
468469
1. If |event|'s [=AppHistoryNavigateEvent/navigation action promise=] is null, then set it to [=a promise resolved with=] undefined, created in |realm|.
469470
1. [=promise/React=] to |event|'s [=AppHistoryNavigateEvent/navigation action promise=] with the following fulfillment steps:

0 commit comments

Comments
 (0)