Skip to content

Instantly share code, notes, and snippets.

Object.getOwnPropertyDescriptors(O)

When the getOwnPropertyDescriptors function is called, the following steps are taken:

  1. Let obj be ToObject(O).
  2. ReturnIfAbrupt(obj).
  3. Let keys be the result of calling the [[OwnPropertyKeys]] internal method of obj.
  4. ReturnIfAbrupt(keys).
  5. Let descriptors be the result of ObjectCreate(null).
  6. Let gotAllNames be false.
@anba
anba / CssLintLoop.java
Created July 30, 2012 15:53
Minimal test case for 'Infinite loop with rhino1.7R4'
package org.mozilla.javascript.tests;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
@anba
anba / TestPreExec.java
Created July 10, 2012 14:25
Using preExec-script to provide __dirname in Rhino's CommonJS implementation
public class TestPreExec {
@Test
public void testPre() {
Context context = Context.enter();
try {
ScriptableObject scope = context.initStandardObjects();
URI uri = URI.create(TestPreExec.class.getResource(".")
.toExternalForm());
Iterable<URI> privilegedUris = singletonList(uri);