Opened 12 months ago

Last modified 8 months ago

#6448 new change

Consider the possibility to use ES6 modules

Reported by: sergz Assignee:
Priority: P4 Milestone:
Module: Libadblockplus Keywords:
Cc: mjethani Blocked By:
Blocking: #6447 Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by hfiguiere)

Background

The issue #6447 implies the usage of the new syntax, however it also affects the loading mechanism, including such questions like what API should be used, how paths are resolved, what data can be passed around, etc. As the result of this issue we should be also aware about limitations of the current implementation of ES6 modules.

It seems there is already support of such functionality in V8 (https://v8project.blogspot.de/2016/04/es6-es7-and-beyond.html, https://bugs.chromium.org/p/v8/issues/detail?id=1569), though it can be not finished yet. At least in the currently used version of V8.

What to change

  • First of all switch to not deprecated API for v8::Script::Compile (see v8.h and CompileScript in JsEngine.cpp), one should use static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(Local<Context> context, Local<String> source, ScriptOrigin* origin = nullptr);. In order to support modules see how ScriptOrigin is used in some other projects (firstly check d8), e.g. mentioned in the v8 bug tracker, https://github.com/pinepain/php-v8).
  • Pay attention to class V8_EXPORT Module class (in v8.h), however firstly V8 should be updated.

Change History (3)

comment:1 Changed 12 months ago by sergz

  • Blocking 6447 added

comment:2 Changed 8 months ago by mjethani

I have closed #6447. We don't have time to work on this, nor is it a good time according to @agiammarchi.

comment:3 Changed 8 months ago by hfiguiere

  • Description modified (diff)
Note: See TracTickets for help on using tickets.