Coder Social home page Coder Social logo

dom.js's People

Contributors

andreasgal avatar davidflanagan avatar fzzzy avatar ltworf avatar sideshowbarker avatar taustin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dom.js's Issues

Reality and DOMCore disagree about document.ownerDocument

jQuery expects Document.ownerDocument to be null, and both Firefox and Chrome return null. dom.js depends on Document.ownerDocument being itself, and has a comment that says DOMCore requires it:

    // DOMCore says that documents are always associated with themselves.
    this.ownerDocument = this;

investigate using private names instead of weak maps

I implemented a private name patch for FF, that works roughly like this:

var name = Name();
obj[name] = foo;

These names are not enumerated and there is no way to get to them without having access to the name instance. This might be more efficient than weak maps.

Newbie question

Hi,
(I am sorry if this is not the right forum, if not, please direct me to one):

I am new to proxies and came across this project. A dumb question, using Dom.js, can I intercept all calls made to the window and/or document object by the Web app? If yes, can I run this in a Firefox extension and still intercept all calls? Or if I am running in a Firefox extension, is there a easier way to do that?

Thanks in advance,
Sunil

Contact information?

Hey, guys. I'm wondering if the dom.js project can provide some contact information (or better yet, a newsgroup) for discussions about the project. I've had some thoughts, but I need a forum to express them in (and a blog post on Planet Mozilla is not appropriate).

src/impl/Node.js: insert() is broken

If I do insertBefore() to move a node before one of its own siblings, the internal insert() method doesn't do the right thing because the index changes after the node is removed, and then it gets inserted at the wrong spot. This is causing a test falure in tests/jsdom/core.js: hc_nodeinsertbeforenewchildexists...

Gathering coverage statistics requires a patch to SpiderMonkey

host-4-64:mozilla-central donovan$ hg diff
diff -r a690d8fbcc48 js/src/shell/js.cpp
--- a/js/src/shell/js.cpp   Mon Aug 08 17:21:29 2011 -0400
+++ b/js/src/shell/js.cpp   Tue Aug 09 10:02:38 2011 -0700
@@ -5678,9 +5678,25 @@
     return true;
 }

+
+JSTrapStatus
+CoverageHook(JSContext *cx, JSScript *script,
+             jsbytecode *pc, jsval *rval, void *closure)
+{
+    fprintf((FILE *)closure, "%s ---------- %d\n",
+            JS_GetScriptFilename(cx, script),
+            JS_PCToLineNumber(cx, script, pc));
+   fflush((FILE *)closure);
+
+    return JSTRAP_CONTINUE;
+}
+
+
 static int
 ProcessArgs(JSContext *cx, JSObject *obj, OptionParser *op)
 {
+    FILE * coverage_file = NULL;
+
     if (op->getBoolOption('a'))
         JS_ToggleOptions(cx, JSOPTION_METHODJIT_ALWAYS);

@@ -5689,6 +5705,15 @@
         JS_ToggleOptions(cx, JSOPTION_METHODJIT);
     }

+    if (op->getBoolOption('c')) {
+       char filename[256];
+       // We open this file but never close it. Since we use it until the process dies,
+       // we don't really need to close it. Messy, but the code to close the file
+       // properly was messier.
+        coverage_file = fopen("coverage.out", "a");
+        JS_SetInterrupt(cx->runtime, &CoverageHook, coverage_file);
+    }
+
 #ifdef JS_GC_ZEAL
     if (const char *zeal = op->getStringOption('Z'))
         ParseZealArg(cx, zeal);
@@ -5957,6 +5982,7 @@
     if (!op.addMultiStringOption('f', "file", "PATH", "File path to run")
         || !op.addMultiStringOption('e', "execute", "CODE", "Inline code to run")
         || !op.addBoolOption('i', "shell", "Enter prompt after running code")
+        || !op.addBoolOption('c', "coverage", "Write filenames and line numbers of executed code to coverage.out")
         || !op.addBoolOption('m', "methodjit", "Enable the JaegerMonkey method JIT")
         || !op.addBoolOption('j', "tracejit", "Enable the JaegerMonkey trace JIT")
         || !op.addBoolOption('p', "profiling", "Enable runtime profiling select JIT mode")
diff -r a690d8fbcc48 js/src/tests/jstests.py
--- a/js/src/tests/jstests.py   Mon Aug 08 17:21:29 2011 -0400
+++ b/js/src/tests/jstests.py   Tue Aug 09 10:02:38 2011 -0700
@@ -241,6 +241,8 @@
                   help='extra args to pass to valgrind')
     op.add_option('-c', '--check-manifest', dest='check_manifest', action='store_true',
                   help='check for test files not listed in the manifest')
+    op.add_option('-C', '--coverage', dest='coverage', action='store_true',
+                  help='gather data on which lines were executed while running tests.')
     op.add_option('--failure-file', dest='failure_file',
                   help='write tests that have not passed to the given file')
     op.add_option('--run-slow-tests', dest='run_slow_tests', action='store_true',
@@ -276,6 +278,10 @@
     else:
         debugger_prefix = []

+    if OPTIONS.coverage:
+        ## If gathering coverage tell spidermonkey to record coverage
+        OPTIONS.shell_args += ' -c'
+
     TestTask.set_js_cmd_prefix(JS, OPTIONS.shell_args.split(), debugger_prefix)

     output_file = sys.stdout

dom.js in node.js

Hi

I have compiled dom.js and now want to use it in node.js.

How to get started? When I run the generated dom.js in node I get a few errors (const in strict mode, and then Function.prototype not defined...).

Thanks

update to latest proxy spec

TC39 decided to leave 'this' bound to the handler and pass the receiver as an extra 1st argument to all proxy handler traps that walk the proto chain. Switch to that new syntax (patches for FF are under review).

dom.js and Rhino (Java 7 ScriptEngine)

Hi,

when I try to evaluate dom.js using the ScriptEngine in Java, it returns the following exception:

Property "nodeValue" already defined in this object literal. (#1131) in at line number 1131

I was hoping to use dom.js in conjunction with jQuery to do dom manipulation of HTML markup.

usage examples

it would be helpful to have a one or two examples how to use the dom.js in practice. sure there are the test but it wouldn't hurt to have some examples in the README.md

readyState throwing not yet implemented prevents henri's parser from loading

I just wanted someplace to stick this patch until readyState is really implemented.

--- a/src/impl/Document.js
+++ b/src/impl/Document.js
@@ -418,7 +418,7 @@ defineLazyProperty(impl, "Document", function() {
referrer: attribute(nyi),
cookie: attribute(nyi, nyi),
lastModified: attribute(nyi),

  •    readyState: attribute(nyi),
    
  •    readyState: attribute(function() { return "complete" }),
     title: attribute(nyi, nyi),
     dir:  attribute(nyi, nyi),
     // Return the first <body> child of the document element.
    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.