Ignore:
Timestamp:
Apr 22, 2016, 5:40:43 PM (9 years ago)
Author:
[email protected]
Message:

Web Inspector: Source directives lost when using Function constructor repeatedly
https://bugs.webkit.org/show_bug.cgi?id=156863
<rdar://problem/25861064>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-04-22
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Source directives (sourceURL and sourceMappingURL) are normally accessed through
the SourceProvider and normally set when the script is parsed. However, when a
CodeCache lookup skips parsing, the new SourceProvider never gets the directives
(sourceURL/sourceMappingURL). This patch stores the directives on the UnlinkedCodeBlock
and UnlinkedFunctionExecutable when entering the cache, and copies to the new providers
when the cache is used.

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::sourceURLDirective):
(JSC::UnlinkedCodeBlock::sourceMappingURLDirective):
(JSC::UnlinkedCodeBlock::setSourceURLDirective):
(JSC::UnlinkedCodeBlock::setSourceMappingURLDirective):

  • bytecode/UnlinkedFunctionExecutable.h:
  • parser/SourceProvider.h:
  • runtime/CodeCache.cpp:

(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):

  • runtime/CodeCache.h:

Store directives on the unlinked code block / executable when adding
to the cache, so they can be used to update new providers when the
cache gets used.

  • runtime/JSGlobalObject.cpp:

Add needed header after CodeCache header cleanup.

LayoutTests:

  • inspector/debugger/sourceURL-repeated-identical-executions-expected.txt: Added.
  • inspector/debugger/sourceURL-repeated-identical-executions.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CodeCache.h

    r198989 r199939  
    2727#define CodeCache_h
    2828
    29 #include "CodeSpecializationKind.h"
    3029#include "ExecutableInfo.h"
    3130#include "ParserModes.h"
     
    3534#include <wtf/CurrentTime.h>
    3635#include <wtf/Forward.h>
    37 #include <wtf/RandomNumber.h>
    38 #include <wtf/WeakRandom.h>
    3936#include <wtf/text/WTFString.h>
    4037
     
    4239
    4340class EvalExecutable;
    44 class FunctionMetadataNode;
    4541class Identifier;
    46 class JSScope;
     42class ModuleProgramExecutable;
    4743class ParserError;
    4844class ProgramExecutable;
    49 class ModuleProgramExecutable;
     45class SourceCode;
    5046class UnlinkedCodeBlock;
    5147class UnlinkedEvalCodeBlock;
     48class UnlinkedFunctionExecutable;
    5249class UnlinkedModuleProgramCodeBlock;
    53 class UnlinkedFunctionCodeBlock;
    54 class UnlinkedFunctionExecutable;
    5550class UnlinkedProgramCodeBlock;
    5651class VM;
    57 class SourceCode;
    58 class SourceProvider;
    5952class VariableEnvironment;
    6053
Note: See TracChangeset for help on using the changeset viewer.