Ignore:
Timestamp:
Jul 3, 2015, 10:38:20 AM (10 years ago)
Author:
Yusuke Suzuki
Message:

Relax builtin JS restriction about try-catch
https://bugs.webkit.org/show_bug.cgi?id=146555

Reviewed by Sam Weinig.

When retrieving the captured variables from the full activated scope,
it swapped the given vector with the stored declared variables vector.
This is because retrieving the captured variables are executed in the
last sequence of the parser, so declared variables are no longer used.
However, in builtins functions case, after retrieving the captured
variables, we check the variables by using declared variables vector.
So at that time, the declared variables vector becomes empty and it
raises assertion failures when the builtins function contains the full
activated scope. try-catch's catch scope requires the upper scope full
activated, so JS code in the builtins cannot use the try-catch.

This patch relaxes this restriction. When retrieving the captured
variables from the scope, just copy to the given vector.

  • parser/Parser.h:

(JSC::Scope::getCapturedVariables):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r186246 r186260  
    312312        if (m_needsFullActivation || m_usesEval) {
    313313            modifiedParameter = true;
    314             capturedVariables.swap(m_declaredVariables);
     314            capturedVariables = m_declaredVariables;
    315315            return;
    316316        }
Note: See TracChangeset for help on using the changeset viewer.