mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-23 14:13:47 +01:00
30 lines
591 B
JavaScript
30 lines
591 B
JavaScript
/* */
|
|
var SYMBOL_ITERATOR = require("./$.wks")('iterator'),
|
|
SAFE_CLOSING = false;
|
|
try {
|
|
var riter = [7][SYMBOL_ITERATOR]();
|
|
riter['return'] = function() {
|
|
SAFE_CLOSING = true;
|
|
};
|
|
Array.from(riter, function() {
|
|
throw 2;
|
|
});
|
|
} catch (e) {}
|
|
module.exports = function(exec) {
|
|
if (!SAFE_CLOSING)
|
|
return false;
|
|
var safe = false;
|
|
try {
|
|
var arr = [7],
|
|
iter = arr[SYMBOL_ITERATOR]();
|
|
iter.next = function() {
|
|
safe = true;
|
|
};
|
|
arr[SYMBOL_ITERATOR] = function() {
|
|
return iter;
|
|
};
|
|
exec(arr);
|
|
} catch (e) {}
|
|
return safe;
|
|
};
|