The problem
On a page whose response lists no JavaScript property at all, fod.promise
never settles. Page code that awaits it waits forever.
This is true on main today, so it is not something the create last
work introduced. It was found while that work was proved, and it is raised
here rather than fixed there because fixing it properly is its own change.
What was checked
JavaScriptResource.mustache on main at 13ba5e7, line 382, and on the
create last branch
(#23) at line
875. When processJsProperties starts no snippet, started stays at zero
and the branch releases its hold and sets the round complete without
calling the constructor's resolve. The promise path never hears that the
round ended.
The identifier and every other value still arrive. update runs,
fod.fodid is published, and both onChange and complete fire. Only the
promise is left pending. That was driven by the template harness on the
create last branch, which has a case for a page with no JavaScript property,
and by the browser tests in
pipeline-dotnet#416,
which wait on complete() rather than on the promise for exactly this
reason.
Why it is not a one line fix
The obvious change is to call resolve in that branch. The constructor's
resolve is not reachable there, so it has to be threaded through. And once
threaded, a later failure on the same page view would try to reject a
promise that has already resolved, which does nothing, so a failure after a
no snippet round would be swallowed silently. The change has to decide which
of those two outcomes a page should see.
Until then
Page code should use fod.complete(callback) rather than awaiting
fod.promise. The template README could say so in one line.
Related
- The create last programme, which is tracked internally
- The template work package, #22
The problem
On a page whose response lists no JavaScript property at all,
fod.promisenever settles. Page code that awaits it waits forever.
This is true on
maintoday, so it is not something the create lastwork introduced. It was found while that work was proved, and it is raised
here rather than fixed there because fixing it properly is its own change.
What was checked
JavaScriptResource.mustacheonmainat 13ba5e7, line 382, and on thecreate last branch
(#23) at line
875. When
processJsPropertiesstarts no snippet,startedstays at zeroand the branch releases its hold and sets the round complete without
calling the constructor's
resolve. The promise path never hears that theround ended.
The identifier and every other value still arrive.
updateruns,fod.fodidis published, and bothonChangeandcompletefire. Only thepromise is left pending. That was driven by the template harness on the
create last branch, which has a case for a page with no JavaScript property,
and by the browser tests in
pipeline-dotnet#416,
which wait on
complete()rather than on the promise for exactly thisreason.
Why it is not a one line fix
The obvious change is to call
resolvein that branch. The constructor'sresolveis not reachable there, so it has to be threaded through. And oncethreaded, a later failure on the same page view would try to reject a
promise that has already resolved, which does nothing, so a failure after a
no snippet round would be swallowed silently. The change has to decide which
of those two outcomes a page should see.
Until then
Page code should use
fod.complete(callback)rather than awaitingfod.promise. The template README could say so in one line.Related