Changeset 65072 in webkit
- Timestamp:
- Aug 10, 2010 9:06:38 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 1 added
- 26 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/CMakeLists.txt
r65059 r65072 1063 1063 inspector/InspectorResource.cpp 1064 1064 inspector/InspectorValues.cpp 1065 inspector/InspectorStorageAgent.cpp 1065 1066 inspector/InspectorTimelineAgent.cpp 1066 1067 inspector/ScriptBreakpoint.cpp -
trunk/WebCore/ChangeLog
r65071 r65072 1 2010-08-10 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: move database processing to native layer. 6 7 https://bugs.webkit.org/show_bug.cgi?id=43788 8 9 * English.lproj/localizedStrings.js: 10 * WebCore.gypi: 11 * bindings/js/JSInjectedScriptHostCustom.cpp: 12 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 13 * inspector/CodeGeneratorInspector.pm: 14 * inspector/InjectedScript.cpp: 15 (WebCore::InjectedScript::dispatch): 16 * inspector/InjectedScript.h: 17 * inspector/InjectedScriptHost.cpp: 18 * inspector/InjectedScriptHost.h: 19 * inspector/InjectedScriptHost.idl: 20 * inspector/Inspector.idl: 21 * inspector/InspectorBackend.cpp: 22 (WebCore::InspectorBackend::dispatchOnInjectedScript): 23 (WebCore::InspectorBackend::executeSQL): 24 * inspector/InspectorBackend.h: 25 * inspector/InspectorController.cpp: 26 (WebCore::InspectorController::connectFrontend): 27 (WebCore::InspectorController::releaseFrontendLifetimeAgents): 28 * inspector/InspectorController.h: 29 * inspector/InspectorDebuggerAgent.h: 30 * inspector/InspectorStorageAgent.cpp: Added. 31 (WebCore::): 32 (WebCore::InspectorStorageAgent::InspectorStorageAgent): 33 (WebCore::InspectorStorageAgent::~InspectorStorageAgent): 34 (WebCore::InspectorStorageAgent::executeSQL): 35 (WebCore::InspectorStorageAgent::clearFrontend): 36 * inspector/InspectorStorageAgent.h: Added. 37 (WebCore::InspectorStorageAgent::create): 38 (WebCore::InspectorStorageAgent::frontend): 39 * inspector/front-end/Database.js: 40 (WebInspector.Database.prototype.executeSql): 41 (WebInspector.sqlTransactionSucceeded): 42 (WebInspector.sqlTransactionFailed): 43 * inspector/front-end/DatabaseQueryView.js: 44 (WebInspector.DatabaseQueryView.prototype._queryFinished): 45 (WebInspector.DatabaseQueryView.prototype._queryError): 46 * inspector/front-end/DatabaseTableView.js: 47 (WebInspector.DatabaseTableView.prototype._queryFinished): 48 * inspector/front-end/InjectedScript.js: 49 * inspector/front-end/InjectedScriptAccess.js: 50 (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName): 51 (InjectedScriptAccess._installHandler): 52 * inspector/front-end/StoragePanel.js: 53 (WebInspector.StoragePanel.prototype.dataGridForResult): 54 1 55 2010-08-10 Steve Block <steveblock@google.com> 2 56 -
trunk/WebCore/GNUmakefile.am
r65059 r65072 1623 1623 WebCore/inspector/InspectorResource.cpp \ 1624 1624 WebCore/inspector/InspectorResource.h \ 1625 WebCore/inspector/InspectorStorageAgent.cpp \ 1626 WebCore/inspector/InspectorStorageAgent.h \ 1625 1627 WebCore/inspector/InspectorTimelineAgent.cpp \ 1626 1628 WebCore/inspector/InspectorTimelineAgent.h \ -
trunk/WebCore/WebCore.gypi
r65059 r65072 1762 1762 'inspector/InspectorResource.cpp', 1763 1763 'inspector/InspectorResource.h', 1764 'inspector/InspectorStorageAgent.cpp', 1765 'inspector/InspectorStorageAgent.h', 1764 1766 'inspector/InspectorTimelineAgent.cpp', 1765 1767 'inspector/InspectorTimelineAgent.h', -
trunk/WebCore/WebCore.pro
r65070 r65072 759 759 inspector/InspectorFrontendHost.cpp \ 760 760 inspector/InspectorResource.cpp \ 761 inspector/InspectorStorageAgent.cpp \ 761 762 inspector/InspectorTimelineAgent.cpp \ 762 763 inspector/InspectorValues.cpp \ … … 1519 1520 inspector/InspectorFrontendHost.h \ 1520 1521 inspector/InspectorResource.h \ 1522 inspector/InspectorStorageAgent.h \ 1521 1523 inspector/InspectorTimelineAgent.h \ 1522 1524 inspector/ScriptGCEventListener.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r65059 r65072 50990 50990 </File> 50991 50991 <File 50992 RelativePath="..\inspector\InspectorStorageAgent.cpp" 50993 > 50994 </File> 50995 <File 50996 RelativePath="..\inspector\InspectorStorageAgent.h" 50997 > 50998 </File> 50999 <File 50992 51000 RelativePath="..\inspector\InspectorTimelineAgent.cpp" 50993 51001 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r65059 r65072 1421 1421 7A74ECBB101839A600BF939E /* InspectorBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorBackend.h */; }; 1422 1422 7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */; }; 1423 7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */; }; 1424 7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.h */; }; 1423 1425 7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; }; 1424 1426 7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 7257 7259 7A74ECB9101839A600BF939E /* InspectorBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackend.h; sourceTree = "<group>"; }; 7258 7260 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; sourceTree = "<group>"; }; 7261 7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorStorageAgent.cpp; sourceTree = "<group>"; }; 7262 7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorStorageAgent.h; sourceTree = "<group>"; }; 7259 7263 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; }; 7260 7264 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; }; … … 11663 11667 41F062000F5F0B6600A07EAC /* InspectorResource.cpp */, 11664 11668 41F061FF0F5F0B6600A07EAC /* InspectorResource.h */, 11669 7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */, 11670 7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.h */, 11665 11671 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */, 11666 11672 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */, … … 20134 20140 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, 20135 20141 CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, 20142 7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */, 20136 20143 ); 20137 20144 runOnlyForDeploymentPostprocessing = 0; … … 22556 22563 E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 22557 22564 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, 22565 7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */, 22558 22566 ); 22559 22567 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r64653 r65072 104 104 } 105 105 106 #if ENABLE(DATABASE)107 JSValue JSInjectedScriptHost::databaseForId(ExecState* exec)108 {109 if (exec->argumentCount() < 1)110 return jsUndefined();111 112 InspectorController* ic = impl()->inspectorController();113 if (!ic)114 return jsUndefined();115 116 Database* database = impl()->databaseForId(exec->argument(0).toInt32(exec));117 if (!database)118 return jsUndefined();119 return toJS(exec, database);120 }121 #endif122 123 106 #if ENABLE(JAVASCRIPT_DEBUGGER) 124 107 JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec) … … 192 175 } 193 176 #endif 194 195 JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec)196 {197 if (exec->argumentCount() < 3)198 return jsUndefined();199 200 if (!exec->argument(0).isInt32())201 return jsUndefined();202 int callId = exec->argument(0).asInt32();203 204 RefPtr<InspectorValue> result = ScriptValue(exec->argument(1)).toInspectorValue(exec);205 206 bool isException;207 if (!exec->argument(2).getBoolean(isException))208 return jsUndefined();209 impl()->reportDidDispatchOnInjectedScript(callId, result, isException);210 return jsUndefined();211 }212 177 213 178 InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState) -
trunk/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r64653 r65072 165 165 166 166 #if ENABLE(DATABASE) 167 v8::Handle<v8::Value> V8InjectedScriptHost::databaseForIdCallback(const v8::Arguments& args)168 {169 INC_STATS("InjectedScriptHost.databaseForId()");170 if (args.Length() < 1)171 return v8::Undefined();172 173 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());174 Database* database = host->databaseForId(args[0]->ToInt32()->Value());175 if (!database)176 return v8::Undefined();177 return toV8(database);178 }179 180 167 v8::Handle<v8::Value> V8InjectedScriptHost::selectDatabaseCallback(const v8::Arguments& args) 181 168 { … … 208 195 } 209 196 #endif 210 211 v8::Handle<v8::Value> V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback(const v8::Arguments& args)212 {213 INC_STATS("InjectedScriptHost.reportDidDispatchOnInjectedScript()");214 if (args.Length() < 3)215 return v8::Undefined();216 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());217 int callId = args[0]->ToInt32()->Value();218 RefPtr<InspectorValue> result = ScriptValue(args[1]).toInspectorValue(ScriptState::current());219 bool isException = args[2]->ToBoolean()->Value();220 host->reportDidDispatchOnInjectedScript(callId, result, isException);221 return v8::Undefined();222 }223 197 224 198 InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState) -
trunk/WebCore/inspector/CodeGeneratorInspector.pm
r65068 r65072 238 238 239 239 my $notify = $function->signature->extendedAttributes->{"notify"}; 240 my $async = $function->signature->extendedAttributes->{"async"}; 241 return if !$async && !$notify; 240 return if !$notify; 242 241 my $functionName = $notify ? $function->signature->name : "did" . ucfirst($function->signature->name); 243 242 … … 342 341 } 343 342 344 my $async = $function->signature->extendedAttributes->{"async"}; 345 my $args = join(", ", (grep($async || !($_ eq "callId"), map($_->name, @inArgs)), map("&" . $_->name, @outArgs))); 343 my $args = join(", ", (grep(!($_ eq "callId"), map($_->name, @inArgs)), map("&" . $_->name, @outArgs))); 346 344 push(@function, " $handlerAccessor->$functionName($args);"); 347 345 348 # The results of function call should be transfered back to frontend (except async methods - need to fix that).349 if (scalar(grep($_->name eq "callId", @inArgs)) && !$async) {346 # The results of function call should be transfered back to frontend. 347 if (scalar(grep($_->name eq "callId", @inArgs))) { 350 348 my @pushArguments = map(" arguments->push" . $typeTransform{$_->type}->{"accessorSuffix"} . "(" . $_->name . ");", @outArgs); 351 349 -
trunk/WebCore/inspector/InjectedScript.cpp
r64653 r65072 45 45 } 46 46 47 void InjectedScript::dispatch( long callId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException)47 void InjectedScript::dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException) 48 48 { 49 49 ASSERT(!hasNoValue()); … … 56 56 function.appendArgument(methodName); 57 57 function.appendArgument(arguments); 58 if (async)59 function.appendArgument(callId);60 58 *hadException = false; 61 59 ScriptValue resultValue = function.call(*hadException); -
trunk/WebCore/inspector/InjectedScript.h
r65021 r65072 49 49 bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); } 50 50 51 void dispatch( long callId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException);51 void dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException); 52 52 #if ENABLE(JAVASCRIPT_DEBUGGER) 53 53 PassRefPtr<InspectorValue> callFrames(); -
trunk/WebCore/inspector/InjectedScriptHost.cpp
r64951 r65072 143 143 #endif 144 144 145 void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, PassRefPtr<InspectorValue> result, bool isException)146 {147 if (RemoteInspectorFrontend* frontend = remoteFrontend())148 frontend->didDispatchOnInjectedScript(callId, result, isException);149 }150 151 145 InjectedScript InjectedScriptHost::injectedScriptForId(long id) 152 146 { -
trunk/WebCore/inspector/InjectedScriptHost.h
r65053 r65072 83 83 void didDestroyWorker(long id); 84 84 #endif 85 void reportDidDispatchOnInjectedScript(long callId, PassRefPtr<InspectorValue> result, bool isException);86 85 87 86 pair<long, ScriptObject> injectScript(const String& source, ScriptState*); -
trunk/WebCore/inspector/InjectedScriptHost.idl
r61655 r65072 45 45 46 46 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 47 [Custom] DOMObject databaseForId(in long databaseId);48 47 [Custom] void selectDatabase(in DOMObject database); 49 48 #endif … … 58 57 long nextWorkerId(); 59 58 #endif 60 [Custom] void reportDidDispatchOnInjectedScript(in long callId, in DOMObject result, in boolean isException);61 59 }; 62 60 } -
trunk/WebCore/inspector/Inspector.idl
r65052 r65072 158 158 #endif 159 159 [handler=Backend] void setInjectedScriptSource(in String scriptSource); 160 [handler=Backend , async] void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in String methodName, in String arguments, in boolean async, out Value result, out boolean isException);160 [handler=Backend] void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException); 161 161 [handler=Controller] void addScriptToEvaluateOnLoad(in String scriptSource); 162 162 [handler=Controller] void removeAllScriptsToEvaluateOnLoad(); … … 207 207 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 208 208 [handler=Backend] void getDatabaseTableNames(in long callId, in long databaseId, out Array tableNames); 209 [handler=Backend] void executeSQL(in long callId, in long databaseId, in String query, out boolean success, out long transactionId); 210 [notify] void sqlTransactionSucceeded(out long transactionId, out Value columnNames, out Value values); 211 [notify] void sqlTransactionFailed(out long transactionId, out Value sqlError); 209 212 #endif 210 213 -
trunk/WebCore/inspector/InspectorBackend.cpp
r64986 r65072 41 41 #include "InspectorController.h" 42 42 #include "InspectorDOMAgent.h" 43 #include "InspectorStorageAgent.h" 43 44 #include "RemoteInspectorFrontend.h" 44 45 #include "ScriptBreakpoint.h" … … 86 87 } 87 88 88 void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException)89 void InspectorBackend::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException) 89 90 { 90 91 if (!remoteFrontend()) … … 103 104 return; 104 105 105 injectedScript.dispatch(callId, methodName, arguments, async, result, hadException); 106 if (async) 107 return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript. 108 remoteFrontend()->didDispatchOnInjectedScript(callId, (*result).get(), *hadException); 106 injectedScript.dispatch(methodName, arguments, result, hadException); 109 107 } 110 108 … … 130 128 } 131 129 } 130 131 void InspectorBackend::executeSQL(long databaseId, const String& query, bool* success, long* transactionId) 132 { 133 Database* database = m_inspectorController->databaseForId(databaseId); 134 if (!m_inspectorController->m_storageAgent || !database) { 135 *success = false; 136 return; 137 } 138 139 *transactionId = m_inspectorController->m_storageAgent->executeSQL(database, query); 140 *success = true; 141 } 142 132 143 #endif 133 144 -
trunk/WebCore/inspector/InspectorBackend.h
r64986 r65072 67 67 68 68 void setInjectedScriptSource(const String& source); 69 void dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException);69 void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException); 70 70 void clearConsoleMessages(); 71 71 … … 75 75 #if ENABLE(DATABASE) 76 76 void getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names); 77 void executeSQL(long databaseId, const String& query, bool* success, long* transactionId); 77 78 #endif 78 79 -
trunk/WebCore/inspector/InspectorController.cpp
r65068 r65072 64 64 #include "InspectorDebuggerAgent.h" 65 65 #include "InspectorResource.h" 66 #include "InspectorStorageAgent.h" 67 #include "InspectorTimelineAgent.h" 66 68 #include "InspectorValues.h" 67 69 #include "InspectorWorkerResource.h" 68 #include "InspectorTimelineAgent.h"69 70 #include "Page.h" 70 71 #include "ProgressTracker.h" … … 478 479 m_remoteFrontend = new RemoteInspectorFrontend(m_client); 479 480 m_domAgent = InspectorDOMAgent::create(m_cssStore.get(), m_remoteFrontend.get()); 481 482 #if ENABLE(DATABASE) 483 m_storageAgent = InspectorStorageAgent::create(m_remoteFrontend.get()); 484 #endif 485 480 486 if (m_timelineAgent) 481 487 m_timelineAgent->resetFrontendProxyObject(m_remoteFrontend.get()); … … 599 605 m_domAgent->reset(); 600 606 m_domAgent.clear(); 607 if (m_storageAgent) 608 m_storageAgent->clearFrontend(); 609 m_storageAgent.clear(); 601 610 602 611 #if ENABLE(OFFLINE_WEB_APPLICATIONS) -
trunk/WebCore/inspector/InspectorController.h
r65068 r65072 66 66 class InspectorFrontendClient; 67 67 class InspectorResource; 68 class InspectorStorageAgent; 68 69 class InspectorTimelineAgent; 69 70 class InspectorValue; … … 329 330 OwnPtr<RemoteInspectorFrontend> m_remoteFrontend; 330 331 RefPtr<InspectorDOMAgent> m_domAgent; 332 RefPtr<InspectorStorageAgent> m_storageAgent; 331 333 OwnPtr<InspectorCSSStore> m_cssStore; 332 334 OwnPtr<InspectorTimelineAgent> m_timelineAgent; -
trunk/WebCore/inspector/InspectorStorageAgent.h
r65071 r65072 1 1 /* 2 * Copyright (C) 20 07, 2008 Apple Inc.All rights reserved.2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 */ 28 28 29 WebInspector.Database = function(id, domain, name, version) 30 { 31 this._id = id; 32 this._domain = domain; 33 this._name = name; 34 this._version = version; 35 } 29 #ifndef InspectorStorageAgent_h 30 #define InspectorStorageAgent_h 36 31 37 WebInspector.Database.prototype = { 38 get id() 32 #include "PlatformString.h" 33 #include "wtf/PassRefPtr.h" 34 35 namespace WebCore { 36 37 class Database; 38 class RemoteInspectorFrontend; 39 40 class InspectorStorageAgent : public RefCounted<InspectorStorageAgent> { 41 public: 42 static PassRefPtr<InspectorStorageAgent> create(RemoteInspectorFrontend* frontend) 39 43 { 40 return this._id;41 } ,44 return adoptRef(new InspectorStorageAgent(frontend)); 45 } 42 46 43 get name() 44 { 45 return this._name; 46 }, 47 virtual ~InspectorStorageAgent(); 47 48 48 set name(x) 49 { 50 this._name = x; 51 }, 49 long executeSQL(Database*, const String& query); 52 50 53 get version() 54 { 55 return this._version; 56 }, 51 RemoteInspectorFrontend* frontend() { return m_frontend; } 52 void clearFrontend(); 57 53 58 set version(x) 59 { 60 this._version = x; 61 }, 54 private: 55 InspectorStorageAgent(RemoteInspectorFrontend*); 62 56 63 get domain() 64 { 65 return this._domain; 66 }, 57 RemoteInspectorFrontend* m_frontend; 58 }; 67 59 68 set domain(x) 69 { 70 this._domain = x; 71 }, 60 } // namespace WebCore 72 61 73 get displayDomain() 74 { 75 return WebInspector.Resource.prototype.__lookupGetter__("displayDomain").call(this); 76 }, 77 78 getTableNames: function(callback) 79 { 80 function sortingCallback(names) 81 { 82 callback(names.sort()); 83 } 84 var callId = WebInspector.Callback.wrap(sortingCallback); 85 InspectorBackend.getDatabaseTableNames(callId, this._id); 86 }, 87 88 executeSql: function(query, onSuccess, onError) 89 { 90 function callback(result) 91 { 92 if (!(result instanceof Array)) { 93 onError(result); 94 return; 95 } 96 onSuccess(result); 97 } 98 // FIXME: execute the query in the frame the DB comes from. 99 InjectedScriptAccess.getDefault().executeSql(this._id, query, callback); 100 } 101 } 102 62 #endif // !defined(InspectorStorageAgent_h) -
trunk/WebCore/inspector/front-end/Database.js
r65052 r65072 34 34 this._version = version; 35 35 } 36 37 WebInspector.Database.successCallbacks = {}; 38 WebInspector.Database.errorCallbacks = {}; 36 39 37 40 WebInspector.Database.prototype = { … … 88 91 executeSql: function(query, onSuccess, onError) 89 92 { 90 function callback( result)93 function callback(success, transactionId) 91 94 { 92 if (! (result instanceof Array)) {93 onError( result);95 if (!success) { 96 onError(WebInspector.UIString("Database not found.")); 94 97 return; 95 98 } 96 onSuccess(result); 99 WebInspector.Database.successCallbacks[transactionId] = onSuccess; 100 WebInspector.Database.errorCallbacks[transactionId] = onError; 97 101 } 98 // FIXME: execute the query in the frame the DB comes from. 99 InjectedScriptAccess.getDefault().executeSql(this._id, query, callback); 102 InspectorBackend.executeSQL(WebInspector.Callback.wrap(callback), this._id, query); 100 103 } 101 104 } 102 105 106 WebInspector.sqlTransactionSucceeded = function(transactionId, columnNames, values) 107 { 108 var callback = WebInspector.Database.successCallbacks[transactionId]; 109 if (!callback) 110 return; 111 delete WebInspector.Database.successCallbacks[transactionId]; 112 callback(columnNames, values); 113 } 114 115 WebInspector.sqlTransactionFailed = function(transactionId, errorObj) 116 { 117 var callback = WebInspector.Database.errorCallbacks[transactionId]; 118 if (!callback) 119 return; 120 delete WebInspector.Database.errorCallbacks[transactionId]; 121 callback(errorObj); 122 } -
trunk/WebCore/inspector/front-end/DatabaseQueryView.js
r57789 r65072 138 138 }, 139 139 140 _queryFinished: function(query, result)140 _queryFinished: function(query, columnNames, values) 141 141 { 142 var dataGrid = WebInspector.panels.storage.dataGridForResult( result);142 var dataGrid = WebInspector.panels.storage.dataGridForResult(columnNames, values); 143 143 var trimmedQuery = query.trim(); 144 144 … … 155 155 _queryError: function(query, error) 156 156 { 157 if (error. code == 1)157 if (error.message) 158 158 var message = error.message; 159 159 else if (error.code == 2) -
trunk/WebCore/inspector/front-end/DatabaseTableView.js
r54436 r65072 55 55 }, 56 56 57 _queryFinished: function( result)57 _queryFinished: function(columnNames, values) 58 58 { 59 59 this.element.removeChildren(); 60 60 61 var dataGrid = WebInspector.panels.storage.dataGridForResult( result);61 var dataGrid = WebInspector.panels.storage.dataGridForResult(columnNames, values); 62 62 if (!dataGrid) { 63 63 var emptyMsgElement = document.createElement("div"); -
trunk/WebCore/inspector/front-end/InjectedScript.js
r64458 r65072 473 473 } 474 474 475 InjectedScript.executeSql = function(callId, databaseId, query)476 {477 function successCallback(tx, result)478 {479 var rows = result.rows;480 var result = [];481 var length = rows.length;482 for (var i = 0; i < length; ++i) {483 var data = {};484 result.push(data);485 var row = rows.item(i);486 for (var columnIdentifier in row) {487 // FIXME: (Bug 19439) We should specially format SQL NULL here488 // (which is represented by JavaScript null here, and turned489 // into the string "null" by the String() function).490 var text = row[columnIdentifier];491 data[columnIdentifier] = String(text);492 }493 }494 InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, result, false);495 }496 497 function errorCallback(tx, error)498 {499 InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, error, false);500 }501 502 function queryTransaction(tx)503 {504 tx.executeSql(query, null, successCallback, errorCallback);505 }506 507 var database = InjectedScriptHost.databaseForId(databaseId);508 if (!database)509 errorCallback(null, { code : 2 }); // Return as unexpected version.510 database.transaction(queryTransaction, errorCallback);511 return true;512 }513 514 475 InjectedScript._isDefined = function(object) 515 476 { -
trunk/WebCore/inspector/front-end/InjectedScriptAccess.js
r65052 r65072 67 67 var callId = WebInspector.Callback.wrap(myCallback); 68 68 69 InspectorBackend.dispatchOnInjectedScript(callId, this._injectedScriptId, methodName, argsString , !!async);69 InspectorBackend.dispatchOnInjectedScript(callId, this._injectedScriptId, methodName, argsString); 70 70 }; 71 71 } … … 85 85 InjectedScriptAccess._installHandler("pushNodeToFrontend"); 86 86 InjectedScriptAccess._installHandler("setPropertyValue"); 87 88 // Some methods can't run synchronously even on the injected script side (such as DB transactions).89 // Mark them as asynchronous here.90 InjectedScriptAccess._installHandler("executeSql", true);91 -
trunk/WebCore/inspector/front-end/StoragePanel.js
r64265 r65072 299 299 }, 300 300 301 dataGridForResult: function(rows) 302 { 303 if (!rows.length) 301 dataGridForResult: function(columnNames, values) 302 { 303 var numColumns = columnNames.length; 304 if (!numColumns) 304 305 return null; 305 306 306 307 var columns = {}; 307 var numColumns = 0; 308 309 for (var columnIdentifier in rows[0]) { 308 309 for (var i = 0; i < columnNames.length; ++i) { 310 310 var column = {}; 311 column.width = column Identifier.length;312 column.title = column Identifier;311 column.width = columnNames[i].length; 312 column.title = columnNames[i]; 313 313 column.sortable = true; 314 314 315 columns[columnIdentifier] = column; 316 ++numColumns; 315 columns[columnNames[i]] = column; 317 316 } 318 317 319 318 var nodes = []; 320 var length = rows.length; 321 for (var i = 0; i < length; ++i) { 319 for (var i = 0; i < values.length / numColumns; ++i) { 322 320 var data = {}; 323 324 var row = rows[i]; 325 for (var columnIdentifier in row) 326 data[columnIdentifier] = row[columnIdentifier]; 321 for (var j = 0; j < columnNames.length; ++j) 322 data[columnNames[j]] = values[numColumns * i + j]; 327 323 328 324 var node = new WebInspector.DataGridNode(data, false);
Note: See TracChangeset
for help on using the changeset viewer.