Hello,

after a lot of trouble with misterious errors "HTTP Error 500: Internal
Server Error" and "HTTP Error 502: Bad Gateway", I've uploaded my
repository.

https://bitbucket.org/schlegea/mozilla-central-js-tproxy-fork

The name of the repository is bad choosen, it's not a fork, only a copy
for experimental research.

My work for the moment:

  * Implement a new trap "isTransparent" for distinguish between
    transparent and opaque Proxies (transparent proxies in comparisms
    are compared by it's targets)
  * Implement a method which gives either the target (case is a
    transparent proxy) or the given object back
  * Use the method for compare Objects in LooselyEqual and StrictlyEqual
    of Interpreter.cpp
  * Manipulate WeakMap with new hash structure:
      o if Key is a transparent proxy
          + first inserted object builds the key element (behaviour like
            implemented)
          + target of transparent proxy is hashed
          + if a new transparent proxy for the target is inserted only
            the value is updated not the key
      o if key is an opaque proxy
          + no changes for the behaviour
  * Manipulate Map/Set hash structure:
      o if Key is a transparent proxy
          + last inserted object builds the key element (behaviour like
            implemented)
          + target of transparent proxy is hashed
          + if a new transparent proxy for the target is inserted the
            complete element is updated
      o if key is an opaque proxy
          + no changes for the behaviour

The tests for JSTest are in "js/src/tests/ecma_6/Proxy".

The tests for the JIT are
"js/src/jit-test/tests/basic/testComparisons.js" and
"js/src/jit-test/tests/basic/testComparisons_loop.js".

----------

I'm working at the moment at the problem, that if I have a global with a
transparent proxy, this proxy needs also the implementation of the
CrossCompartmentWrapper. But I have problems to get the implementation
to work. I've tried to implement the same trap like the trap for the
ScrptedProxyHandler for the DirektProxyHandler and use
Wrapper::isTransparent() in the isTransparent()-method of the
CrossCompartmentWrapper:

bool
CrossCompartmentWrapper::isTransparent(JSContext *cx, HandleObject
wrapper, bool *bp)
{
    return Wrapper::isTransparent(cx, wrapper, bp);
}


I use the following function GetDirectProxyHandlerObject to get the
Handler Object like in the ScriptedProxyHandler, but in this case I get
an assertion in the function "toObjectOrNull()":
Assertion failure: isObjectOrNull(), at ../dist/include/js/Value.h:1157

static JSObject *
GetDirectProxyHandlerObject(JSObject *proxy)
{
    return proxy->as<ProxyObject>().extra(0).toObjectOrNull();
}

bool
DirectProxyHandler::isTransparent(JSContext *cx, HandleObject proxy,
bool *bp)
{
    // step 1
    RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));

    // step 2
    JSString* propStr = JS_InternString(cx, "isTransparent");
    JSAtom& atom = propStr->asAtom();
    RootedValue trap(cx);
    if (!JSObject::getProperty(cx, handler, handler,
atom.asPropertyName(), &trap))
        return false;

    // step 3
    if (trap.isUndefined())
    {
        *bp = false;
        return true;
    }

    // step 4
    Value argv[] = {
    //    ObjectOrNullValue(target),
    //    value
    };
    RootedValue trapResult(cx);
    if (!Invoke(cx, ObjectValue(*handler), trap, 0, argv, &trapResult))
        return false;

    // step 5
    bool success = ToBoolean(trapResult);

    // step 6
    *bp = success;
    return true;
}

How can I retrieve the proxy handler to get the data from the trap?

Thanks a lot
Andreas

Am 16.01.2014 14:31, schrieb Till Schneidereit:
> On Thu, Jan 16, 2014 at 2:22 PM, Andreas Schlegel
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Yes it is a clone of mozilla-central, but if I create an empty
>     repository and upload the data, is the history also uploaded?
>     If I import an repository I can only import it over an URL, not
>     locally.
>
>
> History is also uploaded if you follow the guide I linked to, yes.
>
> bitbucket and http://mercurial.selenic.com/ have pretty good
> introductory guides, which might help you in working on this.

_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to