Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:42
    rhuanjl synchronize #5885
  • Jan 31 2019 22:39
    MikeHolman synchronize #5923
  • Jan 31 2019 22:28
    MikeHolman synchronize #5923
  • Jan 31 2019 19:48
    MikeHolman synchronize #5923
  • Jan 31 2019 19:03
    penzn synchronize #5903
  • Jan 31 2019 17:15
    penzn synchronize #5903
  • Jan 30 2019 22:33
    wyrichte opened #5927
  • Jan 30 2019 22:33

    wyrichte on ADO_test

    Update ChakraCoreStatic.cpp (compare)

  • Jan 30 2019 22:32
    wyrichte closed #5916
  • Jan 30 2019 20:20
    MikeHolman synchronize #5923
  • Jan 30 2019 19:56
    MikeHolman synchronize #5923
  • Jan 30 2019 19:53
    MikeHolman synchronize #5923
  • Jan 30 2019 19:35

    wyrichte on Test-PR-webhook---don't-merge

    Update ChakraCoreStatic.cpp (compare)

  • Jan 30 2019 19:35
    wyrichte synchronize #5916
  • Jan 30 2019 19:07
    wyrichte synchronize #5925
  • Jan 30 2019 18:54

    wyrichte on Test-PR-webhook---don't-merge

    Update ChakraCoreStatic.cpp (compare)

  • Jan 30 2019 18:54
    wyrichte synchronize #5916
  • Jan 30 2019 18:12
    wyrichte closed #5926
  • Jan 30 2019 18:12
    wyrichte opened #5926
  • Jan 30 2019 01:43
    wyrichte synchronize #5925
Richard
@rhuanjl
@Fly-Style I think I'm the only regular external contributor to chakracore it would be cool to have another one around
I guess that covers node-chakracore.
Jani Turunen
@Janisku7
I dont support chromium browsers so it wouldbe cool to have edgeHtml OSS too
Tom Care
@tcare
@liminzhu has put up a statement about the future of ChakraCore in #5865 @Mouvedia @CatCatCatDog @fatcerberus
Bruce Pascoe
@fatcerberus
Is there a stable link I can use in my Makefile to fetch the ChakraCore Linux binaries? Most Linux distros don't have an official package for CC so I need to fetch the binaries manually but I don't want to commit them
Bruce Pascoe
@fatcerberus
I'm fetching from https://aka.ms/chakracore/cc_linux_x64_1_11_4 for now... so far it seems to be stable
Jimmy Thomson
@MSLaguana
That link should exist for at least a year or so; there is some expiry I think, but it's long
Bruce Pascoe
@fatcerberus
Is it possible to retrieve bytecode using the debugger API? I would like to experiment with making a bytecode visualizer
i.e. you hover over a line of JS, it highlights the bytecode generated for that line in the dump
So I guess in my reality my requirements are:
  1. Ability to get a bytecode dump via the API
  2. Ability to map generated bytecode instructions to source lines
Jimmy Thomson
@MSLaguana
I don't believe that we expose any of that to js-land debuggers (including via our debugging API). We have internal native debugging tools which can do that, and the bytecode instruction -> source line functionality is built in to the bytecode, but I don't think we surface that via JSRT at all
Bruce Pascoe
@fatcerberus
I guess that makes sense since there’s no versioning guarantees for bytecode. Would make things difficult for the host maintainer
Bruce Pascoe
@fatcerberus
Is there a Jsrt API I can call to get the url of the script that called a native function?
Jimmy Thomson
@MSLaguana
It's not obvious to me what exactly that would mean. One possible hackish solution would be to do (new Error()).stack and see what that gives you. In node-chakracore we had some small amount of support for inspecting error.stack without just getting back an opaque string, but I forget exactly how we did that right now
(it was all via the chakrashim host layer, so any host can do it)
Bruce Pascoe
@fatcerberus
Essentially I want something like arguments.caller.filename but in native land (I know that’s illegal in JS)
What I’m trying to do is support relative paths in require() called from an ES module
In CommonJS that works because each module gets its own copy of require, but for ESM I’d need to know the URI of the module that called require
Jimmy Thomson
@MSLaguana
I think in node that's handled by specializing require before passing it in to the script each time (specifically by having a module object which knows the path, and the require function uses that module object internally)
Bruce Pascoe
@fatcerberus
Yes, CJS just gives a unique require to each module - which works because modules are function-wrapped. For ESM I can’t do that trick
Jimmy Thomson
@MSLaguana
This isn't so you can have import with relative paths, is it? It's just your own require function?
Bruce Pascoe
@fatcerberus
Yes, import with relative path already works fine since the import callback gets the ModuleRecord of the parent
Pulling the stack trace off an Error object was my first idea too, but wondered if there was a “sanctioned” solution
Jimmy Thomson
@MSLaguana
I'm not aware of one
There's also weirdness with this whole idea, like e.g. what would ["a.js", "b.js"].map(require) do? What is the "caller" of require there?
Bruce Pascoe
@fatcerberus
The other idea we had was to append a require() to the module source upon loading and let it be hoisted, but I didn’t like having the host see anything other than exactly what was typed in the text editor
Intuitively, I would want that resolved against the module calling .map
Jimmy Thomson
@MSLaguana
But in that case the direct caller is the library function implementing .map
And even if in this case we skip over internal library frames, the same issue could come up from shims or other things providing non-default library functionality
From an engine perspective, it's basically impossible to tell them apart I think, so the best way in my mind is to be specific and essentially bind the function to a particular context, e.g. specialize it for a given module
And yeah, I think the simplest way to do that is to do something like the commonjs approach where you inject a bit of code at the start
If you jam it all on one line, then it wouldn't impact user code much at all
But if they do put things on the first line (especially if it's minified) then that could be a pain
Ondrej Kelle
@tondrej
How about using JsSetModuleHostInfo with JsModuleHostInfo_HostDefined?
Ondrej Kelle
@tondrej
or maybe even with JsModuleHostInfo_Url
Bruce Pascoe
@fatcerberus
That’s not the problem - the problem is that I have no way to know which module was responsible for the require() call in the first place. If I did, then it would be trivial to pull the URL from it
But as @MSLaguana points out, higher-order functions complicate matters
Ondrej Kelle
@tondrej
@fatcerberus I see now, thanks.
Grahame Grieve
@grahamegrieve
If I try jsParseScript with an invalid script, I get back SyntaxError expected { - how can I get a line number for the error?
Bruce Pascoe
@fatcerberus
Read the .line property of the error object
Grahame Grieve
@grahamegrieve
where do I get the error object? i get an error code...?
Bruce Pascoe
@fatcerberus
Clearly you have a JS error object if you were able to read back “expected {“?
The error object is returned via result IIRC
If you string coerce it you only get the error message but you can read properties off it instead
It’s the same thing you would get back in JS for try { eval(invalid_code); } catch(err) { ... }
Grahame Grieve
@grahamegrieve
ok I think I follow that. Thank you for your patience
Grahame Grieve
@grahamegrieve
so I'm dense, or out of my depth here... I get what I think is the object you are talking about using JsGetAndClearException(obj). Using JsConvertValueToString/JsStringToPointer, I get the string I referred to above. So then I try to get the line property from it - using JsGetPropertyIdFromName and then JsGetProperty - and I get undefined for the value of the property.
Grahame Grieve
@grahamegrieve
no. I had to use JsCreatePropertyId instead of JsGetPropertyIdFromName. Why that is is not at all obvious from the documentation.
Ondrej Kelle
@tondrej
@grahamegrieve if you're using Pascal in chakracore-delphi you could pass the result of JsParse to ChakraCoreCheck which would raise an exception in your host app based on the error object, with properties like Line, Column, Source, URL.