Changeset 70181 in webkit
- Timestamp:
- Oct 20, 2010 2:49:37 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r70177 r70181 1 2010-10-20 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r70165. 4 http://trac.webkit.org/changeset/70165 5 https://bugs.webkit.org/show_bug.cgi?id=48007 6 7 It broke tests on Qt bot (Requested by Ossy on #webkit). 8 9 * GNUmakefile.am: 10 * JavaScriptCore.gypi: 11 * JavaScriptCore.xcodeproj/project.pbxproj: 12 * wtf/text/TextPosition.h: Removed. 13 1 14 2010-10-20 Brian Weinstein <bweinstein@apple.com> 2 15 -
trunk/JavaScriptCore/GNUmakefile.am
r70165 r70181 518 518 JavaScriptCore/wtf/text/StringImpl.h \ 519 519 JavaScriptCore/wtf/text/StringStatics.cpp \ 520 JavaScriptCore/wtf/text/TextPosition.h \521 520 JavaScriptCore/wtf/text/WTFString.cpp \ 522 521 JavaScriptCore/wtf/text/WTFString.h \ -
trunk/JavaScriptCore/JavaScriptCore.gypi
r70165 r70181 461 461 'wtf/text/StringImpl.h', 462 462 'wtf/text/StringStatics.cpp', 463 'wtf/text/TextPosition.h',464 463 'wtf/text/WTFString.cpp', 465 464 'wtf/text/WTFString.h', -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r70165 r70181 555 555 E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EF79A80CE97BA60088D500 /* UTF8.cpp */; }; 556 556 E48E0F2D0F82151700A8CA37 /* FastAllocBase.h in Headers */ = {isa = PBXBuildFile; fileRef = E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 557 F3BD31ED126735770065467F /* TextPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BD31D0126730180065467F /* TextPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };558 557 FE1B447A0ECCD73B004F4DD1 /* StdLibExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1B44790ECCD73B004F4DD1 /* StdLibExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; 559 558 /* End PBXBuildFile section */ … … 1144 1143 E1EF79A90CE97BA60088D500 /* UTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTF8.h; sourceTree = "<group>"; }; 1145 1144 E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastAllocBase.h; sourceTree = "<group>"; }; 1146 F3BD31D0126730180065467F /* TextPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextPosition.h; path = text/TextPosition.h; sourceTree = "<group>"; };1147 1145 F5BB2BC5030F772101FCFE1D /* Completion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Completion.h; sourceTree = "<group>"; tabWidth = 8; }; 1148 1146 F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCorePrefix.h; sourceTree = "<group>"; tabWidth = 8; }; … … 1860 1858 86B99AE2117E578100DF5A90 /* StringImplBase.h */, 1861 1859 8626BECE11928E3900782FAB /* StringStatics.cpp */, 1862 F3BD31D0126730180065467F /* TextPosition.h */,1863 1860 868BFA15117CF19900B908B1 /* WTFString.cpp */, 1864 1861 868BFA16117CF19900B908B1 /* WTFString.h */, … … 2350 2347 A730B6121250068F009D25B1 /* StrictEvalActivation.h in Headers */, 2351 2348 933F5CDC1269229B0049191E /* NullPtr.h in Headers */, 2352 F3BD31ED126735770065467F /* TextPosition.h in Headers */,2353 2349 ); 2354 2350 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/ChangeLog
r70172 r70181 1 2010-10-20 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r70165. 4 http://trac.webkit.org/changeset/70165 5 https://bugs.webkit.org/show_bug.cgi?id=48007 6 7 It broke tests on Qt bot (Requested by Ossy on #webkit). 8 9 * ForwardingHeaders/wtf/text/TextPosition.h: Removed. 10 * bindings/js/ScriptSourceCode.h: 11 (WebCore::ScriptSourceCode::ScriptSourceCode): 12 * bindings/v8/ScheduledAction.cpp: 13 (WebCore::ScheduledAction::ScheduledAction): 14 * bindings/v8/ScriptController.cpp: 15 (WebCore::ScriptController::eventHandlerLineNumber): 16 (WebCore::ScriptController::eventHandlerColumnNumber): 17 * bindings/v8/ScriptController.h: 18 * bindings/v8/ScriptEventListener.cpp: 19 (WebCore::createAttributeEventListener): 20 * bindings/v8/ScriptSourceCode.h: 21 (WebCore::ScriptSourceCode::ScriptSourceCode): 22 (WebCore::ScriptSourceCode::startLine): 23 * bindings/v8/V8LazyEventListener.cpp: 24 (WebCore::V8LazyEventListener::V8LazyEventListener): 25 (WebCore::V8LazyEventListener::prepareListenerObject): 26 * bindings/v8/V8LazyEventListener.h: 27 (WebCore::V8LazyEventListener::create): 28 * bindings/v8/V8Proxy.cpp: 29 (WebCore::V8Proxy::compileScript): 30 (WebCore::V8Proxy::evaluate): 31 (WebCore::V8Proxy::runScript): 32 * bindings/v8/V8Proxy.h: 33 * bindings/v8/WorkerContextExecutionProxy.cpp: 34 (WebCore::WorkerContextExecutionProxy::evaluate): 35 (WebCore::WorkerContextExecutionProxy::runScript): 36 * bindings/v8/WorkerContextExecutionProxy.h: 37 * bindings/v8/WorkerScriptController.cpp: 38 (WebCore::WorkerScriptController::evaluate): 39 * dom/PendingScript.cpp: 40 (WebCore::PendingScript::releaseElementAndClear): 41 * dom/PendingScript.h: 42 (WebCore::PendingScript::PendingScript): 43 (WebCore::PendingScript::operator=): 44 (WebCore::PendingScript::startingLineNumber): 45 * dom/ScriptableDocumentParser.h: 46 * dom/XMLDocumentParser.h: 47 * dom/XMLDocumentParserLibxml2.cpp: 48 (WebCore::XMLDocumentParser::XMLDocumentParser): 49 (WebCore::XMLDocumentParser::startElementNs): 50 (WebCore::XMLDocumentParser::endElementNs): 51 (WebCore::XMLDocumentParser::lineNumber): 52 (WebCore::XMLDocumentParser::columnNumber): 53 * dom/XMLDocumentParserQt.cpp: 54 (WebCore::XMLDocumentParser::XMLDocumentParser): 55 (WebCore::XMLDocumentParser::parseStartElement): 56 (WebCore::XMLDocumentParser::parseEndElement): 57 * html/parser/HTMLDocumentParser.cpp: 58 (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): 59 (WebCore::HTMLDocumentParser::columnNumber): 60 * html/parser/HTMLDocumentParser.h: 61 * html/parser/HTMLScriptRunner.cpp: 62 (WebCore::HTMLScriptRunner::sourceFromPendingScript): 63 (WebCore::HTMLScriptRunner::execute): 64 (WebCore::HTMLScriptRunner::runScript): 65 * html/parser/HTMLScriptRunner.h: 66 * html/parser/HTMLTreeBuilder.cpp: 67 (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): 68 (WebCore::HTMLTreeBuilder::takeScriptToProcess): 69 (WebCore::HTMLTreeBuilder::processEndTag): 70 (WebCore::HTMLTreeBuilder::processScriptStartTag): 71 * html/parser/HTMLTreeBuilder.h: 72 1 73 2010-10-20 David Hyatt <hyatt@apple.com> 2 74 -
trunk/WebCore/bindings/js/ScriptSourceCode.h
r70165 r70181 36 36 #include "StringSourceProvider.h" 37 37 #include "KURL.h" 38 #include <wtf/text/TextPosition.h>39 38 #include <wtf/RefPtr.h> 40 39 … … 43 42 class ScriptSourceCode { 44 43 public: 45 ScriptSourceCode(const String& source, const KURL& url = KURL(), const TextPosition1& startPosition = TextPosition1::minimumPosition())44 ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1) 46 45 : m_provider(StringSourceProvider::create(source, url.isNull() ? String() : url.string())) 47 , m_code(m_provider, start Position.m_line.oneBasedInt())46 , m_code(m_provider, startLine) 48 47 , m_url(url) 49 48 { -
trunk/WebCore/bindings/v8/ScheduledAction.cpp
r70165 r70181 46 46 ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> func, int argc, v8::Handle<v8::Value> argv[]) 47 47 : m_context(context) 48 , m_code(String(), KURL(), TextPosition1::belowRangePosition())48 , m_code(String(), KURL(), 0) 49 49 { 50 50 m_function = v8::Persistent<v8::Function>::New(func); -
trunk/WebCore/bindings/v8/ScriptController.cpp
r70165 r70181 263 263 } 264 264 265 TextPosition0 ScriptController::eventHandlerPosition() const265 int ScriptController::eventHandlerLineNumber() const 266 266 { 267 267 ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentParser(); 268 268 if (parser) 269 return parser->textPosition(); 270 return TextPosition0::minimumPosition(); 269 return parser->lineNumber(); 270 return 0; 271 } 272 273 int ScriptController::eventHandlerColumnNumber() const 274 { 275 ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentParser(); 276 if (parser) 277 return parser->columnNumber(); 278 return 0; 271 279 } 272 280 -
trunk/WebCore/bindings/v8/ScriptController.h
r70165 r70181 156 156 void finishedWithEvent(Event*); 157 157 158 TextPosition0 eventHandlerPosition() const; 158 int eventHandlerLineNumber() const; 159 int eventHandlerColumnNumber() const; 159 160 160 161 void setProcessingTimerCallback(bool processingTimerCallback) { m_processingTimerCallback = processingTimerCallback; } -
trunk/WebCore/bindings/v8/ScriptEventListener.cpp
r70165 r70181 51 51 return 0; 52 52 53 // FIXME: Very strange: we initialize zero-based number with '1'.54 TextPosition0 position(WTF::ZeroBasedNumber::fromZeroBasedInt(1), WTF::ZeroBasedNumber::base());53 int lineNumber = 1; 54 int columnNumber = 0; 55 55 String sourceURL; 56 56 … … 65 65 } 66 66 67 position = scriptController->eventHandlerPosition(); 67 lineNumber = scriptController->eventHandlerLineNumber(); 68 columnNumber = scriptController->eventHandlerColumnNumber(); 68 69 sourceURL = node->document()->url().string(); 69 70 } 70 71 71 return V8LazyEventListener::create(attr->localName().string(), node->isSVGElement(), attr->value(), sourceURL, position, WorldContextHandle(UseMainWorld));72 return V8LazyEventListener::create(attr->localName().string(), node->isSVGElement(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld)); 72 73 } 73 74 … … 81 82 return 0; 82 83 84 int lineNumber = 1; 85 int columnNumber = 0; 86 String sourceURL; 87 83 88 ScriptController* scriptController = frame->script(); 84 89 if (!scriptController->canExecuteScripts(AboutToExecuteScript)) … … 90 95 } 91 96 92 TextPosition0 position = scriptController->eventHandlerPosition(); 93 String sourceURL = frame->document()->url().string(); 94 return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, position, WorldContextHandle(UseMainWorld)); 97 lineNumber = scriptController->eventHandlerLineNumber(); 98 columnNumber = scriptController->eventHandlerColumnNumber(); 99 sourceURL = frame->document()->url().string(); 100 return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld)); 95 101 } 96 102 -
trunk/WebCore/bindings/v8/ScriptSourceCode.h
r70165 r70181 36 36 #include "KURL.h" 37 37 #include "PlatformString.h" 38 #include <wtf/text/TextPosition.h>39 38 40 39 namespace WebCore { … … 42 41 class ScriptSourceCode { 43 42 public: 44 ScriptSourceCode(const String& source, const KURL& url = KURL(), const TextPosition1& startPosition = TextPosition1::minimumPosition())43 ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1) 45 44 : m_source(source) 46 45 , m_cachedScript(0) 47 46 , m_url(url) 48 , m_start Position(startPosition)47 , m_startLine(startLine) 49 48 { 50 49 } … … 56 55 , m_cachedScript(cs) 57 56 , m_url(ParsedURLString, cs->url()) 58 , m_start Position(TextPosition1::minimumPosition())57 , m_startLine(1) 59 58 { 60 59 } … … 65 64 CachedScript* cachedScript() const { return m_cachedScript.get(); } 66 65 const KURL& url() const { return m_url; } 67 int startLine() const { return m_startPosition.m_line.oneBasedInt(); } 68 const TextPosition1& startPosition() const { return m_startPosition; } 66 int startLine() const { return m_startLine; } 69 67 70 68 private: … … 72 70 CachedResourceHandle<CachedScript> m_cachedScript; 73 71 KURL m_url; 74 TextPosition1 m_startPosition;72 int m_startLine; 75 73 }; 76 74 -
trunk/WebCore/bindings/v8/V8LazyEventListener.cpp
r70165 r70181 42 42 namespace WebCore { 43 43 44 V8LazyEventListener::V8LazyEventListener(const String& functionName, bool isSVGEvent, const String& code, const String sourceURL, const TextPosition0& position, const WorldContextHandle& worldContext)44 V8LazyEventListener::V8LazyEventListener(const String& functionName, bool isSVGEvent, const String& code, const String sourceURL, int lineNumber, int columnNumber, const WorldContextHandle& worldContext) 45 45 : V8AbstractEventListener(true, worldContext) 46 46 , m_functionName(functionName) … … 48 48 , m_code(code) 49 49 , m_sourceURL(sourceURL) 50 , m_position(position) 50 , m_lineNumber(lineNumber) 51 , m_columnNumber(columnNumber) 51 52 { 52 53 } … … 114 115 code.append( "\n}).call(this, evt);}}}})"); 115 116 v8::Handle<v8::String> codeExternalString = v8ExternalString(code); 116 v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_sourceURL, m_ position);117 v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_sourceURL, m_lineNumber); 117 118 if (!script.IsEmpty()) { 118 119 v8::Local<v8::Value> value = proxy->runScript(script, false); -
trunk/WebCore/bindings/v8/V8LazyEventListener.h
r70165 r70181 35 35 #include "V8AbstractEventListener.h" 36 36 #include <v8.h> 37 #include <wtf/text/TextPosition.h>38 37 #include <wtf/PassRefPtr.h> 39 38 … … 47 46 class V8LazyEventListener : public V8AbstractEventListener { 48 47 public: 49 static PassRefPtr<V8LazyEventListener> create(const String& functionName, bool isSVGEvent, const String& code, const String& sourceURL, const TextPosition0& position, const WorldContextHandle& worldContext)48 static PassRefPtr<V8LazyEventListener> create(const String& functionName, bool isSVGEvent, const String& code, const String& sourceURL, int lineNumber, int columnNumber, const WorldContextHandle& worldContext) 50 49 { 51 return adoptRef(new V8LazyEventListener(functionName, isSVGEvent, code, sourceURL, position, worldContext));50 return adoptRef(new V8LazyEventListener(functionName, isSVGEvent, code, sourceURL, lineNumber, columnNumber, worldContext)); 52 51 } 53 52 … … 58 57 59 58 private: 60 V8LazyEventListener(const String& functionName, bool isSVGEvent, const String& code, const String sourceURL, const TextPosition0& position, const WorldContextHandle& worldContext);59 V8LazyEventListener(const String& functionName, bool isSVGEvent, const String& code, const String sourceURL, int lineNumber, int columnNumber, const WorldContextHandle& worldContext); 61 60 62 61 virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*); … … 72 71 String m_code; 73 72 String m_sourceURL; 74 TextPosition0 m_position; 73 int m_lineNumber; 74 int m_columnNumber; 75 75 }; 76 76 -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r70165 r70181 236 236 } 237 237 238 v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* scriptData)238 v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* scriptData) 239 239 { 240 240 const uint16_t* fileNameString = fromWebCoreString(fileName); 241 241 v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length()); 242 v8::Handle<v8::Integer> line = v8::Integer::New(scriptStartPosition.m_line.zeroBasedInt()); 243 v8::Handle<v8::Integer> column = v8::Integer::New(scriptStartPosition.m_column.zeroBasedInt()); 244 v8::ScriptOrigin origin(name, line, column); 242 v8::Handle<v8::Integer> line = v8::Integer::New(baseLine); 243 v8::ScriptOrigin origin(name, line); 245 244 v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData); 246 245 return script; … … 395 394 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at 396 395 // 1, whereas v8 starts at 0. 397 v8::Handle<v8::Script> script = compileScript(code, source.url(), WTF::toZeroBasedTextPosition(source.startPosition()), scriptData.get());396 v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1, scriptData.get()); 398 397 #if PLATFORM(CHROMIUM) 399 398 PlatformBridge::traceEventEnd("v8.compile", node, ""); … … 427 426 // script passed to us as the argument instead of using an empty string 428 427 // and 0 baseLine. 429 script = compileScript(code, "", TextPosition0::minimumPosition());428 script = compileScript(code, "", 0); 430 429 } 431 430 -
trunk/WebCore/bindings/v8/V8Proxy.h
r70165 r70181 280 280 static v8::Handle<v8::Value> checkNewLegal(const v8::Arguments&); 281 281 282 static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* = 0);282 static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* = 0); 283 283 284 284 // If the exception code is different from zero, a DOM exception is -
trunk/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
r70165 r70181 185 185 } 186 186 187 ScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, const TextPosition0& scriptStartPosition, WorkerContextExecutionState* state)187 ScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, int baseLine, WorkerContextExecutionState* state) 188 188 { 189 189 v8::HandleScope hs; … … 197 197 198 198 v8::Local<v8::String> scriptString = v8ExternalString(script); 199 v8::Handle<v8::Script> compiledScript = V8Proxy::compileScript(scriptString, fileName, scriptStartPosition);199 v8::Handle<v8::Script> compiledScript = V8Proxy::compileScript(scriptString, fileName, baseLine); 200 200 v8::Local<v8::Value> result = runScript(compiledScript); 201 201 … … 228 228 if (m_recursion >= kMaxRecursionDepth) { 229 229 v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')"); 230 script = V8Proxy::compileScript(code, "", TextPosition0::minimumPosition());230 script = V8Proxy::compileScript(code, "", 0); 231 231 } 232 232 -
trunk/WebCore/bindings/v8/WorkerContextExecutionProxy.h
r70165 r70181 37 37 #include "ScriptValue.h" 38 38 #include <v8.h> 39 #include <wtf/text/TextPosition.h>40 39 #include <wtf/OwnPtr.h> 41 40 #include <wtf/Vector.h> … … 68 67 69 68 // Evaluate a script file in the current execution environment. 70 ScriptValue evaluate(const String& script, const String& fileName, const TextPosition0& scriptStartPosition, WorkerContextExecutionState*);69 ScriptValue evaluate(const String& script, const String& fileName, int baseLine, WorkerContextExecutionState*); 71 70 72 71 // Returns a local handle of the context. -
trunk/WebCore/bindings/v8/WorkerScriptController.cpp
r70165 r70181 76 76 77 77 WorkerContextExecutionState state; 78 ScriptValue result = m_proxy->evaluate(sourceCode.source(), sourceCode.url().string(), WTF::toZeroBasedTextPosition(sourceCode.startPosition()), &state);78 ScriptValue result = m_proxy->evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startLine() - 1, &state); 79 79 if (state.hadException) { 80 80 if (exception) -
trunk/WebCore/dom/PendingScript.cpp
r70165 r70181 41 41 { 42 42 setCachedScript(0); 43 m_starting Position = TextPosition1::belowRangePosition();43 m_startingLineNumber = 0; 44 44 m_watchingForLoad = false; 45 45 return m_element.release(); -
trunk/WebCore/dom/PendingScript.h
r70165 r70181 29 29 #include "CachedResourceClient.h" 30 30 #include "CachedResourceHandle.h" 31 #include <wtf/text/TextPosition.h>32 31 #include <wtf/PassRefPtr.h> 33 32 … … 45 44 public: 46 45 PendingScript() 47 : m_starting Position(TextPosition1::belowRangePosition())46 : m_startingLineNumber(0) 48 47 , m_watchingForLoad(false) 49 48 { … … 52 51 PendingScript(const PendingScript& other) 53 52 : CachedResourceClient(other) 54 , m_starting Position(other.m_startingPosition)53 , m_startingLineNumber(other.m_startingLineNumber) 55 54 , m_watchingForLoad(other.m_watchingForLoad) 56 55 , m_element(other.m_element) … … 66 65 return *this; 67 66 68 m_starting Position = other.m_startingPosition;67 m_startingLineNumber = other.m_startingLineNumber; 69 68 m_watchingForLoad = other.m_watchingForLoad; 70 69 m_element = other.m_element; … … 76 75 // FIXME: No setter means this is never set to anything other than 0. 77 76 // This is either unnecessary or incorrect. 78 TextPosition1 startingPosition() const { return m_startingPosition; }77 int startingLineNumber() const { return m_startingLineNumber; } 79 78 80 79 bool watchingForLoad() const { return m_watchingForLoad; } … … 91 90 92 91 private: 93 TextPosition1 m_startingPosition; // Only used for inline script tags.92 int m_startingLineNumber; // Only used for inline script tags. 94 93 bool m_watchingForLoad; 95 94 RefPtr<Element> m_element; -
trunk/WebCore/dom/ScriptableDocumentParser.h
r70165 r70181 28 28 29 29 #include "DecodedDataDocumentParser.h" 30 #include <wtf/text/TextPosition.h>31 30 32 31 namespace WebCore { 33 32 33 class SegmentedString; 34 34 class XSSAuditor; 35 35 … … 48 48 // These are used to expose the current line/column to the scripting system. 49 49 virtual int lineNumber() const = 0; 50 virtual TextPosition0 textPosition() const = 0;50 virtual int columnNumber() const = 0; 51 51 52 52 XSSAuditor* xssAuditor() const { return m_xssAuditor; } -
trunk/WebCore/dom/XMLDocumentParser.h
r70165 r70181 103 103 virtual bool wellFormed() const { return !m_sawError; } 104 104 virtual int lineNumber() const; 105 TextPosition0 textPosition() const;105 virtual int columnNumber() const; 106 106 107 107 static bool supportsXMLVersion(const String&); … … 129 129 130 130 bool appendFragmentSource(const String&); 131 132 int columnNumber() const;133 // The method is used in XMLDocumentParserLibxml2.cpp only,134 // It is neither used nor implemented in XMLDocumentParserQt.cpp.135 TextPosition1 textPositionOneBased() const;136 131 137 132 #if USE(QXMLSTREAM) … … 214 209 CachedResourceHandle<CachedScript> m_pendingScript; 215 210 RefPtr<Element> m_scriptElement; 216 TextPosition1 m_scriptStartPosition;211 int m_scriptStartLine; 217 212 218 213 bool m_parsingFragment; -
trunk/WebCore/dom/XMLDocumentParserLibxml2.cpp
r70165 r70181 561 561 , m_lastErrorColumn(0) 562 562 , m_pendingScript(0) 563 , m_scriptStart Position(TextPosition1::belowRangePosition())563 , m_scriptStartLine(0) 564 564 , m_parsingFragment(false) 565 565 , m_scriptingPermission(FragmentScriptingAllowed) … … 588 588 , m_lastErrorColumn(0) 589 589 , m_pendingScript(0) 590 , m_scriptStart Position(TextPosition1::belowRangePosition())590 , m_scriptStartLine(0) 591 591 , m_parsingFragment(true) 592 592 , m_scriptingPermission(scriptingPermission) … … 820 820 ScriptElement* scriptElement = toScriptElement(newElement.get()); 821 821 if (scriptElement) 822 m_scriptStart Position = textPositionOneBased();822 m_scriptStartLine = lineNumber(); 823 823 824 824 m_currentNode->deprecatedParserAddChild(newElement.get()); … … 911 911 m_scriptElement = 0; 912 912 } else 913 m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStart Position));913 m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStartLine)); 914 914 915 915 // JavaScript may have detached the parser … … 1377 1377 int XMLDocumentParser::lineNumber() const 1378 1378 { 1379 // FIXME: The implementation probably returns 1-based int, but method should return 0-based.1380 1379 return context() ? context()->input->line : 1; 1381 1380 } … … 1383 1382 int XMLDocumentParser::columnNumber() const 1384 1383 { 1385 // FIXME: The implementation probably returns 1-based int, but method should return 0-based.1386 1384 return context() ? context()->input->col : 1; 1387 }1388 1389 TextPosition0 XMLDocumentParser::textPosition() const1390 {1391 xmlParserCtxtPtr context = this->context();1392 if (!context)1393 return TextPosition0::minimumPosition();1394 // FIXME: The context probably contains 1-based numbers, but we treat them as 0-based,1395 // to be consistent with fixme's in lineNumber() and columnNumber1396 // methods.1397 return TextPosition0(WTF::ZeroBasedNumber::fromZeroBasedInt(context->input->line),1398 WTF::ZeroBasedNumber::fromZeroBasedInt(context->input->col));1399 }1400 1401 // This method has a correct implementation, in contrast to textPosition() method.1402 // It should replace textPosition().1403 TextPosition1 XMLDocumentParser::textPositionOneBased() const1404 {1405 xmlParserCtxtPtr context = this->context();1406 if (!context)1407 return TextPosition1::minimumPosition();1408 return TextPosition1(WTF::OneBasedNumber::fromOneBasedInt(context->input->line),1409 WTF::OneBasedNumber::fromOneBasedInt(context->input->col));1410 1385 } 1411 1386 -
trunk/WebCore/dom/XMLDocumentParserQt.cpp
r70165 r70181 106 106 , m_lastErrorColumn(0) 107 107 , m_pendingScript(0) 108 , m_scriptStart Position(TextPosition1::belowRangePosition())108 , m_scriptStartLine(0) 109 109 , m_parsingFragment(false) 110 110 , m_scriptingPermission(FragmentScriptingAllowed) … … 133 133 , m_lastErrorColumn(0) 134 134 , m_pendingScript(0) 135 , m_scriptStart Position(TextPosition1::belowRangePosition())135 , m_scriptStartLine(0) 136 136 , m_parsingFragment(true) 137 137 , m_scriptingPermission(permission) … … 235 235 } 236 236 237 TextPosition0 XMLDocumentParser::textPosition() const238 {239 return TextPosition0(WTF::ZeroBasedNumber::fromZeroBasedInt(lineNumber()), WTF::ZeroBasedNumber::fromZeroBasedInt(columnNumber()));240 }241 242 237 void XMLDocumentParser::stopParsing() 243 238 { … … 524 519 ScriptElement* scriptElement = toScriptElement(newElement.get()); 525 520 if (scriptElement) 526 m_scriptStart Position = WTF::toOneBasedTextPosition(textPosition());521 m_scriptStartLine = lineNumber(); 527 522 528 523 m_currentNode->deprecatedParserAddChild(newElement.get()); … … 601 596 m_scriptElement = 0; 602 597 } else 603 m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStart Position));598 m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStartLine)); 604 599 } 605 600 m_requestingScript = false; … … 722 717 } 723 718 } 719 -
trunk/WebCore/html/parser/HTMLDocumentParser.cpp
r70165 r70181 192 192 ASSERT(m_treeBuilder->isPaused()); 193 193 194 TextPosition1 scriptStartPosition = TextPosition1::belowRangePosition();195 RefPtr<Element> scriptElement = m_treeBuilder->takeScriptToProcess(scriptStart Position);194 int scriptStartLine = 0; 195 RefPtr<Element> scriptElement = m_treeBuilder->takeScriptToProcess(scriptStartLine); 196 196 // We will not have a scriptRunner when parsing a DocumentFragment. 197 197 if (!m_scriptRunner) 198 198 return true; 199 return m_scriptRunner->execute(scriptElement.release(), scriptStart Position);199 return m_scriptRunner->execute(scriptElement.release(), scriptStartLine); 200 200 } 201 201 … … 397 397 } 398 398 399 TextPosition0 HTMLDocumentParser::textPosition() const 400 { 401 int lineZeroBased = m_tokenizer->lineNumber(); 402 int columnOneBased = m_tokenizer->columnNumber(); 403 404 return TextPosition0(WTF::ZeroBasedNumber::fromZeroBasedInt(lineZeroBased), 405 WTF::OneBasedNumber::fromOneBasedInt(columnOneBased).convertToZeroBased()); 399 int HTMLDocumentParser::columnNumber() const 400 { 401 return m_tokenizer->columnNumber(); 406 402 } 407 403 -
trunk/WebCore/html/parser/HTMLDocumentParser.h
r70165 r70181 93 93 virtual void executeScriptsWaitingForStylesheets(); 94 94 virtual int lineNumber() const; 95 virtual TextPosition0 textPosition() const;95 virtual int columnNumber() const; 96 96 97 97 // HTMLScriptRunnerHost -
trunk/WebCore/html/parser/HTMLScriptRunner.cpp
r70165 r70181 99 99 } 100 100 errorOccurred = false; 101 return ScriptSourceCode(script.element()->textContent(), documentURLForScriptExecution(m_document), script.starting Position());101 return ScriptSourceCode(script.element()->textContent(), documentURLForScriptExecution(m_document), script.startingLineNumber()); 102 102 } 103 103 … … 171 171 // This function should match 10.2.5.11 "An end tag whose tag name is 'script'" 172 172 // Script handling lives outside the tree builder to keep the each class simple. 173 bool HTMLScriptRunner::execute(PassRefPtr<Element> scriptElement, const TextPosition1& scriptStartPosition)173 bool HTMLScriptRunner::execute(PassRefPtr<Element> scriptElement, int startLine) 174 174 { 175 175 ASSERT(scriptElement); … … 177 177 178 178 // Try to execute the script given to us. 179 runScript(scriptElement.get(), s criptStartPosition);179 runScript(scriptElement.get(), startLine); 180 180 181 181 if (haveParsingBlockingScript()) { … … 289 289 // This method is meant to match the HTML5 definition of "running a script" 290 290 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#running-a-script 291 void HTMLScriptRunner::runScript(Element* script, const TextPosition1& scriptStartPosition)291 void HTMLScriptRunner::runScript(Element* script, int startingLineNumber) 292 292 { 293 293 ASSERT(m_document); … … 316 316 // ASSERT(document()->haveStylesheetsLoaded()); 317 317 ASSERT(isExecutingScript()); 318 ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), s criptStartPosition);318 ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); 319 319 executeScript(sourceCode); 320 320 } -
trunk/WebCore/html/parser/HTMLScriptRunner.h
r70165 r70181 29 29 #include "PendingScript.h" 30 30 #include <wtf/Deque.h> 31 #include <wtf/text/TextPosition.h>32 31 #include <wtf/Noncopyable.h> 33 32 #include <wtf/PassRefPtr.h> … … 54 53 55 54 // Processes the passed in script and any pending scripts if possible. 56 bool execute(PassRefPtr<Element> scriptToProcess, const TextPosition1& scriptStartPosition);55 bool execute(PassRefPtr<Element> scriptToProcess, int scriptStartLine); 57 56 58 57 bool executeScriptsWaitingForLoad(CachedResource*); … … 78 77 bool requestPendingScript(PendingScript&, Element*) const; 79 78 80 void runScript(Element*, const TextPosition1& scriptStartPosition);79 void runScript(Element*, int startingLineNumber); 81 80 82 81 // Helpers for dealing with HTMLScriptRunnerHost -
trunk/WebCore/html/parser/HTMLTreeBuilder.cpp
r70165 r70181 56 56 57 57 static const int uninitializedLineNumberValue = -1; 58 59 static TextPosition1 uninitializedPositionValue1()60 {61 return TextPosition1(WTF::OneBasedNumber::fromOneBasedInt(-1), WTF::OneBasedNumber::base());62 }63 58 64 59 namespace { … … 339 334 , m_secondaryInsertionMode(InitialMode) 340 335 , m_tokenizer(tokenizer) 341 , m_scriptToProcessStart Position(uninitializedPositionValue1())342 , m_lastScriptElementStart Position(TextPosition0::belowRangePosition())336 , m_scriptToProcessStartLine(uninitializedLineNumberValue) 337 , m_lastScriptElementStartLine(uninitializedLineNumberValue) 343 338 , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks) 344 339 { … … 358 353 , m_secondaryInsertionMode(InitialMode) 359 354 , m_tokenizer(tokenizer) 360 , m_scriptToProcessStart Position(uninitializedPositionValue1())361 , m_lastScriptElementStart Position(TextPosition0::belowRangePosition())355 , m_scriptToProcessStartLine(uninitializedLineNumberValue) 356 , m_lastScriptElementStartLine(uninitializedLineNumberValue) 362 357 , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks) 363 358 { … … 421 416 } 422 417 423 PassRefPtr<Element> HTMLTreeBuilder::takeScriptToProcess( TextPosition1& scriptStartPosition)418 PassRefPtr<Element> HTMLTreeBuilder::takeScriptToProcess(int& scriptStartLine) 424 419 { 425 420 // Unpause ourselves, callers may pause us again when processing the script. … … 428 423 // before running scripts. 429 424 m_isPaused = false; 430 scriptStart Position = m_scriptToProcessStartPosition;431 m_scriptToProcessStart Position = uninitializedPositionValue1();425 scriptStartLine = m_scriptToProcessStartLine; 426 m_scriptToProcessStartLine = uninitializedLineNumberValue; 432 427 return m_scriptToProcess.release(); 433 428 } … … 2207 2202 ASSERT(m_tree.currentElement()->hasTagName(scriptTag)); 2208 2203 m_scriptToProcess = m_tree.currentElement(); 2209 m_scriptToProcessStart Position = WTF::toOneBasedTextPosition(m_lastScriptElementStartPosition);2204 m_scriptToProcessStartLine = m_lastScriptElementStartLine + 1; 2210 2205 m_tree.openElements()->pop(); 2211 2206 if (isParsingFragment() && m_fragmentContext.scriptingPermission() == FragmentScriptingNotAllowed) … … 2756 2751 m_tokenizer->setState(HTMLTokenizer::ScriptDataState); 2757 2752 m_originalInsertionMode = m_insertionMode; 2758 2759 TextPosition0 position = TextPosition0(WTF::ZeroBasedNumber::fromZeroBasedInt(m_tokenizer->lineNumber()), WTF::ZeroBasedNumber::base()); 2760 m_lastScriptElementStartPosition = position; 2761 2753 m_lastScriptElementStartLine = m_tokenizer->lineNumber(); 2762 2754 setInsertionMode(TextMode); 2763 2755 } -
trunk/WebCore/html/parser/HTMLTreeBuilder.h
r70165 r70181 33 33 #include "HTMLFormattingElementList.h" 34 34 #include "HTMLTokenizer.h" 35 #include <wtf/text/TextPosition.h>36 35 #include <wtf/Noncopyable.h> 37 36 #include <wtf/OwnPtr.h> … … 73 72 74 73 // Must be called when parser is paused before calling the parser again. 75 PassRefPtr<Element> takeScriptToProcess( TextPosition1& scriptStartPosition);74 PassRefPtr<Element> takeScriptToProcess(int& scriptStartLine); 76 75 77 76 // Done, close any open tags, etc. … … 248 247 249 248 RefPtr<Element> m_scriptToProcess; // <script> tag which needs processing before resuming the parser. 250 TextPosition1 m_scriptToProcessStartPosition; // Starting line number of the script tag needing processing.249 int m_scriptToProcessStartLine; // Starting line number of the script tag needing processing. 251 250 252 251 // FIXME: We probably want to remove this member. Originally, it was 253 252 // created to service the legacy tree builder, but it seems to be used for 254 253 // some other things now. 255 TextPosition0 m_lastScriptElementStartPosition; 254 int m_lastScriptElementStartLine; 255 256 256 bool m_usePreHTML5ParserQuirks; 257 257 }; -
trunk/WebKit/chromium/ChangeLog
r70165 r70181 1 2010-10-20 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r70165. 4 http://trac.webkit.org/changeset/70165 5 https://bugs.webkit.org/show_bug.cgi?id=48007 6 7 It broke tests on Qt bot (Requested by Ossy on #webkit). 8 9 * src/WebFrameImpl.cpp: 10 (WebKit::WebFrameImpl::executeScript): 11 (WebKit::WebFrameImpl::executeScriptInIsolatedWorld): 12 (WebKit::WebFrameImpl::executeScriptAndReturnValue): 13 1 14 2010-10-20 Peter Rybin <peter.rybin@gmail.com> 2 15 -
trunk/WebKit/chromium/src/WebFrameImpl.cpp
r70165 r70181 754 754 void WebFrameImpl::executeScript(const WebScriptSource& source) 755 755 { 756 TextPosition1 position(WTF::OneBasedNumber::fromOneBasedInt(source.startLine), WTF::OneBasedNumber::base());757 756 m_frame->script()->executeScript( 758 ScriptSourceCode(source.code, source.url, position));757 ScriptSourceCode(source.code, source.url, source.startLine)); 759 758 } 760 759 … … 766 765 767 766 for (unsigned i = 0; i < numSources; ++i) { 768 TextPosition1 position(WTF::OneBasedNumber::fromOneBasedInt(sourcesIn[i].startLine), WTF::OneBasedNumber::base());769 767 sources.append(ScriptSourceCode( 770 sourcesIn[i].code, sourcesIn[i].url, position));768 sourcesIn[i].code, sourcesIn[i].url, sourcesIn[i].startLine)); 771 769 } 772 770 … … 820 818 const WebScriptSource& source) 821 819 { 822 TextPosition1 position(WTF::OneBasedNumber::fromOneBasedInt(source.startLine), WTF::OneBasedNumber::base());823 820 return m_frame->script()->executeScript( 824 ScriptSourceCode(source.code, source.url, position)).v8Value();821 ScriptSourceCode(source.code, source.url, source.startLine)).v8Value(); 825 822 } 826 823
Note: See TracChangeset
for help on using the changeset viewer.