Closed Bug 1225561 Opened 9 years ago Closed 9 years ago

Don't allow a module to export non-existent local bindings

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

While adding tests I realised we don't handle the case where a non-existent variable is exported.  The patch fixes this by adding a check to ModuleBuilder::buildAndInit().

I also renamed that class' methods appendLocalExportEntry() and appendIndirectExportEntry() which both append to exportEntries_ rather than localExportEntries_ and indirectExportEntries_ which might be been expected given the names, and added a new appendLocalExportEntry() which does append to localExportEntries_ after doing the check.
Attachment #8688564 - Flags: review?(shu)
Comment on attachment 8688564 [details] [diff] [review]
check-unbound-local-exports

Review of attachment 8688564 [details] [diff] [review]:
-----------------------------------------------------------------

Oops, good catch.

::: js/src/builtin/ModuleObject.cpp
@@ +993,4 @@
>                                   importEntries,
>                                   localExportEntries,
>                                   indirectExportEntries,
>                                   starExportEntries);

Nit: re-line up the rest of the arguments.
Attachment #8688564 - Flags: review?(shu) → review+
https://hg.mozilla.org/mozilla-central/rev/37ba7d6d75a9
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: