OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); | 612 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); |
613 Document* document = assertDocument(errorString, frame); | 613 Document* document = assertDocument(errorString, frame); |
614 if (!document) | 614 if (!document) |
615 return; | 615 return; |
616 IDBFactory* idbFactory = assertIDBFactory(errorString, document); | 616 IDBFactory* idbFactory = assertIDBFactory(errorString, document); |
617 if (!idbFactory) | 617 if (!idbFactory) |
618 return; | 618 return; |
619 | 619 |
620 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API | 620 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API |
621 v8::HandleScope handleScope(toIsolate(frame)); | 621 v8::HandleScope handleScope(toIsolate(frame)); |
622 v8::Handle<v8::Context> context = document->frame()->script()->mainWorldCont
ext(); | 622 v8::Handle<v8::Context> context = document->frame()->script().mainWorldConte
xt(); |
623 ASSERT(!context.IsEmpty()); | 623 ASSERT(!context.IsEmpty()); |
624 v8::Context::Scope contextScope(context); | 624 v8::Context::Scope contextScope(context); |
625 | 625 |
626 TrackExceptionState es; | 626 TrackExceptionState es; |
627 RefPtr<IDBRequest> idbRequest = idbFactory->getDatabaseNames(document, es); | 627 RefPtr<IDBRequest> idbRequest = idbFactory->getDatabaseNames(document, es); |
628 if (es.hadException()) { | 628 if (es.hadException()) { |
629 requestCallback->sendFailure("Could not obtain database names."); | 629 requestCallback->sendFailure("Could not obtain database names."); |
630 return; | 630 return; |
631 } | 631 } |
632 idbRequest->addEventListener(EventTypeNames::success, GetDatabaseNamesCallba
ck::create(requestCallback, document->securityOrigin()->toRawString()), false); | 632 idbRequest->addEventListener(EventTypeNames::success, GetDatabaseNamesCallba
ck::create(requestCallback, document->securityOrigin()->toRawString()), false); |
633 } | 633 } |
634 | 634 |
635 void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, const St
ring& securityOrigin, const String& databaseName, PassRefPtr<RequestDatabaseCall
back> requestCallback) | 635 void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, const St
ring& securityOrigin, const String& databaseName, PassRefPtr<RequestDatabaseCall
back> requestCallback) |
636 { | 636 { |
637 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); | 637 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); |
638 Document* document = assertDocument(errorString, frame); | 638 Document* document = assertDocument(errorString, frame); |
639 if (!document) | 639 if (!document) |
640 return; | 640 return; |
641 IDBFactory* idbFactory = assertIDBFactory(errorString, document); | 641 IDBFactory* idbFactory = assertIDBFactory(errorString, document); |
642 if (!idbFactory) | 642 if (!idbFactory) |
643 return; | 643 return; |
644 | 644 |
645 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API | 645 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API |
646 v8::HandleScope handleScope(toIsolate(frame)); | 646 v8::HandleScope handleScope(toIsolate(frame)); |
647 v8::Handle<v8::Context> context = document->frame()->script()->mainWorldCont
ext(); | 647 v8::Handle<v8::Context> context = document->frame()->script().mainWorldConte
xt(); |
648 ASSERT(!context.IsEmpty()); | 648 ASSERT(!context.IsEmpty()); |
649 v8::Context::Scope contextScope(context); | 649 v8::Context::Scope contextScope(context); |
650 | 650 |
651 RefPtr<DatabaseLoader> databaseLoader = DatabaseLoader::create(document, req
uestCallback); | 651 RefPtr<DatabaseLoader> databaseLoader = DatabaseLoader::create(document, req
uestCallback); |
652 databaseLoader->start(idbFactory, document->securityOrigin(), databaseName); | 652 databaseLoader->start(idbFactory, document->securityOrigin(), databaseName); |
653 } | 653 } |
654 | 654 |
655 void InspectorIndexedDBAgent::requestData(ErrorString* errorString, const String
& securityOrigin, const String& databaseName, const String& objectStoreName, con
st String& indexName, int skipCount, int pageSize, const RefPtr<JSONObject>* key
Range, PassRefPtr<RequestDataCallback> requestCallback) | 655 void InspectorIndexedDBAgent::requestData(ErrorString* errorString, const String
& securityOrigin, const String& databaseName, const String& objectStoreName, con
st String& indexName, int skipCount, int pageSize, const RefPtr<JSONObject>* key
Range, PassRefPtr<RequestDataCallback> requestCallback) |
656 { | 656 { |
657 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); | 657 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); |
658 Document* document = assertDocument(errorString, frame); | 658 Document* document = assertDocument(errorString, frame); |
659 if (!document) | 659 if (!document) |
660 return; | 660 return; |
661 IDBFactory* idbFactory = assertIDBFactory(errorString, document); | 661 IDBFactory* idbFactory = assertIDBFactory(errorString, document); |
662 if (!idbFactory) | 662 if (!idbFactory) |
663 return; | 663 return; |
664 | 664 |
665 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
ainWorldScriptState(frame)); | 665 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
ainWorldScriptState(frame)); |
666 | 666 |
667 RefPtr<IDBKeyRange> idbKeyRange = keyRange ? idbKeyRangeFromKeyRange(keyRang
e->get()) : 0; | 667 RefPtr<IDBKeyRange> idbKeyRange = keyRange ? idbKeyRangeFromKeyRange(keyRang
e->get()) : 0; |
668 if (keyRange && !idbKeyRange) { | 668 if (keyRange && !idbKeyRange) { |
669 *errorString = "Can not parse key range."; | 669 *errorString = "Can not parse key range."; |
670 return; | 670 return; |
671 } | 671 } |
672 | 672 |
673 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API | 673 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API |
674 v8::HandleScope handleScope(toIsolate(frame)); | 674 v8::HandleScope handleScope(toIsolate(frame)); |
675 v8::Handle<v8::Context> context = document->frame()->script()->mainWorldCont
ext(); | 675 v8::Handle<v8::Context> context = document->frame()->script().mainWorldConte
xt(); |
676 ASSERT(!context.IsEmpty()); | 676 ASSERT(!context.IsEmpty()); |
677 v8::Context::Scope contextScope(context); | 677 v8::Context::Scope contextScope(context); |
678 | 678 |
679 RefPtr<DataLoader> dataLoader = DataLoader::create(document, requestCallback
, injectedScript, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); | 679 RefPtr<DataLoader> dataLoader = DataLoader::create(document, requestCallback
, injectedScript, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); |
680 dataLoader->start(idbFactory, document->securityOrigin(), databaseName); | 680 dataLoader->start(idbFactory, document->securityOrigin(), databaseName); |
681 } | 681 } |
682 | 682 |
683 class ClearObjectStoreListener : public EventListener { | 683 class ClearObjectStoreListener : public EventListener { |
684 WTF_MAKE_NONCOPYABLE(ClearObjectStoreListener); | 684 WTF_MAKE_NONCOPYABLE(ClearObjectStoreListener); |
685 public: | 685 public: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); | 769 Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin); |
770 Document* document = assertDocument(errorString, frame); | 770 Document* document = assertDocument(errorString, frame); |
771 if (!document) | 771 if (!document) |
772 return; | 772 return; |
773 IDBFactory* idbFactory = assertIDBFactory(errorString, document); | 773 IDBFactory* idbFactory = assertIDBFactory(errorString, document); |
774 if (!idbFactory) | 774 if (!idbFactory) |
775 return; | 775 return; |
776 | 776 |
777 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API | 777 // FIXME: This should probably use ScriptState/ScriptScope instead of V8 API |
778 v8::HandleScope handleScope(toIsolate(frame)); | 778 v8::HandleScope handleScope(toIsolate(frame)); |
779 v8::Handle<v8::Context> context = document->frame()->script()->mainWorldCont
ext(); | 779 v8::Handle<v8::Context> context = document->frame()->script().mainWorldConte
xt(); |
780 ASSERT(!context.IsEmpty()); | 780 ASSERT(!context.IsEmpty()); |
781 v8::Context::Scope contextScope(context); | 781 v8::Context::Scope contextScope(context); |
782 | 782 |
783 RefPtr<ClearObjectStore> clearObjectStore = ClearObjectStore::create(documen
t, objectStoreName, requestCallback); | 783 RefPtr<ClearObjectStore> clearObjectStore = ClearObjectStore::create(documen
t, objectStoreName, requestCallback); |
784 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); | 784 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); |
785 } | 785 } |
786 | 786 |
787 } // namespace WebCore | 787 } // namespace WebCore |
OLD | NEW |