Changeset 209149 in webkit


Ignore:
Timestamp:
Nov 30, 2016 1:13:42 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Proxy is not allowed in the global prototype chain.
https://bugs.webkit.org/show_bug.cgi?id=165205

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • runtime/ProgramExecutable.cpp:

(JSC::ProgramExecutable::initializeGlobalProperties):

  • We'll now throw a TypeError if we detect a Proxy in the global prototype chain.

LayoutTests:

  • js/dom/proxy-is-not-allowed-in-global-prototype-chain-expected.txt: Added.
  • js/dom/proxy-is-not-allowed-in-global-prototype-chain.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r209145 r209149  
     12016-11-30  Mark Lam  <mark.lam@apple.com>
     2
     3        Proxy is not allowed in the global prototype chain.
     4        https://bugs.webkit.org/show_bug.cgi?id=165205
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * js/dom/proxy-is-not-allowed-in-global-prototype-chain-expected.txt: Added.
     9        * js/dom/proxy-is-not-allowed-in-global-prototype-chain.html: Added.
     10
    1112016-11-30  Brent Fulgham  <bfulgham@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r209146 r209149  
     12016-11-30  Mark Lam  <mark.lam@apple.com>
     2
     3        Proxy is not allowed in the global prototype chain.
     4        https://bugs.webkit.org/show_bug.cgi?id=165205
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * runtime/ProgramExecutable.cpp:
     9        (JSC::ProgramExecutable::initializeGlobalProperties):
     10        - We'll now throw a TypeError if we detect a Proxy in the global prototype chain.
     11
    1122016-11-30  Commit Queue  <commit-queue@webkit.org>
    213
  • trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp

    r208950 r209149  
    8080    ASSERT(&globalObject->vm() == &vm);
    8181
     82    JSValue nextPrototype = globalObject->getPrototypeDirect();
     83    while (nextPrototype && nextPrototype.isObject()) {
     84        if (UNLIKELY(asObject(nextPrototype)->type() == ProxyObjectType)) {
     85            ExecState* exec = globalObject->globalExec();
     86            return createTypeError(exec, ASCIILiteral("Proxy is not allowed in the global prototype chain."));
     87        }
     88        nextPrototype = asObject(nextPrototype)->getPrototypeDirect();
     89    }
     90   
    8291    JSObject* exception = nullptr;
    8392    UnlinkedProgramCodeBlock* unlinkedCodeBlock = globalObject->createProgramCodeBlock(callFrame, this, &exception);
     
    178187        }
    179188    }
    180     return 0;
     189    return nullptr;
    181190}
    182191
Note: See TracChangeset for help on using the changeset viewer.