facebookarchive/prepack

Prepack emits code containing invalid global.TypedArray access

Open

#2.292 aberto em 18 de jul. de 2018

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (520 forks)batch import
bughelp wantedinterpreter

Métricas do repositório

Stars
 (14.268 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

TypedArray is a global not exposed to the user JavaScript runtime. Try global.TypedArray in your JavaScript environment of choice. We must emit Object.getPrototypeOf(Int8Array) or similar instead of TypedArray.

Input

var TypedArray = Object.getPrototypeOf(Int8Array);
console.log(TypedArray.from.name === "from");

Output

var TypedArray;
(function() {
  var _$0 = this;

  var _$1 = _$0.TypedArray; // <-------------------- `TypedArray` is not exposed on the global object!
  _$0.TypedArray = _$1;
  console.log(true);
}.call(this));

Guia do colaborador