Commit 9eb2289
committed
Bug 1820594 - Part 25: Call FinishLoadingImportedModule for dynamic import. r=jonco
From the specification, ContinueDynamicImport is done inside the engine.
https://tc39.es/ecma262/#sec-ContinueDynamicImport
However, our implementation for EvaluateModuleInContext() has bytecode
encoding related stuff, so for now I implement the ContinueDynamicImport
in the host layer.
Also, the updated spec has a slightly different error handling behavior when
module.Link() fails. I list them below:
Before HTML PR 8253 [whatwg/html#8253]
fetch the descendants of and link a module script
https://web.archive.org/web/20221130023614/https://html.spec.whatwg.org/#fetch-the-descendants-of-and-link-a-module-script
onFetchDescendantsComplete
Step 3.2. Perform record.Link().
If this throws an exception, set result's error to rethrow to that exception.
HostImportModuleDynamically
https://web.archive.org/web/20221130023614/https://html.spec.whatwg.org/#hostimportmoduledynamically(referencingscriptormodule,-modulerequest,-promisecapability)
Step 6.3 Otherwise, set promise to the result of running a module script given result and true.
run a module script
https://web.archive.org/web/20221130023614/https://html.spec.whatwg.org/#run-a-module-script
Step 5. If script's error to rethrow is not null, then set evaluationPromise to a promise rejected with script's error to rethrow.
--------------------------------------------------------
After ECMA262 PR 2905 [tc39/ecma262#2905]
ContinueDynamicImport
Step 6.a Let link be Completion(module.Link()).
Step 6.b If link is an abrupt completion, then
Step 6.b.i. Perform ! Call(promiseCapability.[[Reject]], undefined, « link.[[Value]] »).
Step 6.b.ii. Return unused.
In short,
* The old behavior:
It catched the exception thrown during module.Link(), and set
the module script's error to rethrow to the exception. Later in
Evaluate(), if the module script's error to rethrow is not null,
reject the evaluation promise with the error to rethrow.
* The new behavior:
It simply rejects the evaluation promise with the exception thrown
during module.Link().
Differential Revision: https://phabricator.services.mozilla.com/D2145771 parent a6c79d3 commit 9eb2289
File tree
4 files changed
+44
-93
lines changed- dom/base/test/jsmodules
- js/loader
4 files changed
+44
-93
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
329 | 328 | | |
330 | | - | |
| 329 | + | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| |||
1435 | 1435 | | |
1436 | 1436 | | |
1437 | 1437 | | |
1438 | | - | |
1439 | 1438 | | |
1440 | 1439 | | |
1441 | 1440 | | |
| |||
1448 | 1447 | | |
1449 | 1448 | | |
1450 | 1449 | | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
1456 | | - | |
1457 | | - | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
1480 | 1453 | | |
1481 | 1454 | | |
1482 | 1455 | | |
1483 | 1456 | | |
1484 | 1457 | | |
1485 | 1458 | | |
1486 | | - | |
| 1459 | + | |
1487 | 1460 | | |
1488 | 1461 | | |
1489 | | - | |
| 1462 | + | |
1490 | 1463 | | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
1491 | 1468 | | |
1492 | 1469 | | |
1493 | | - | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | 1470 | | |
1508 | 1471 | | |
1509 | 1472 | | |
| |||
1664 | 1627 | | |
1665 | 1628 | | |
1666 | 1629 | | |
1667 | | - | |
1668 | | - | |
| 1630 | + | |
| 1631 | + | |
1669 | 1632 | | |
1670 | 1633 | | |
1671 | 1634 | | |
1672 | | - | |
1673 | | - | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
1681 | 1640 | | |
1682 | 1641 | | |
1683 | | - | |
1684 | | - | |
1685 | | - | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
1686 | 1647 | | |
1687 | 1648 | | |
1688 | | - | |
1689 | | - | |
1690 | | - | |
| 1649 | + | |
1691 | 1650 | | |
1692 | 1651 | | |
1693 | 1652 | | |
| |||
1732 | 1691 | | |
1733 | 1692 | | |
1734 | 1693 | | |
1735 | | - | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
1739 | | - | |
1740 | 1694 | | |
1741 | 1695 | | |
1742 | 1696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | 540 | | |
564 | 541 | | |
565 | 542 | | |
| |||
0 commit comments