Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp

Issue 1739613002: DevTools: validate protocol input parameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined a test. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 RequestCallback* requestCallback() override { return m_requestCallback.get() ; } 350 RequestCallback* requestCallback() override { return m_requestCallback.get() ; }
351 private: 351 private:
352 DatabaseLoader(ScriptState* scriptState, PassRefPtr<RequestDatabaseCallback> requestCallback) 352 DatabaseLoader(ScriptState* scriptState, PassRefPtr<RequestDatabaseCallback> requestCallback)
353 : ExecutableWithDatabase(scriptState) 353 : ExecutableWithDatabase(scriptState)
354 , m_requestCallback(requestCallback) { } 354 , m_requestCallback(requestCallback) { }
355 RefPtr<RequestDatabaseCallback> m_requestCallback; 355 RefPtr<RequestDatabaseCallback> m_requestCallback;
356 }; 356 };
357 357
358 static IDBKey* idbKeyFromInspectorObject(PassOwnPtr<protocol::IndexedDB::Key> ke y) 358 static IDBKey* idbKeyFromInspectorObject(protocol::IndexedDB::Key* key)
359 { 359 {
360 IDBKey* idbKey; 360 IDBKey* idbKey;
361 361
362 if (!key || !key->hasType()) 362 if (!key)
363 return nullptr; 363 return nullptr;
364 String type = key->getType(); 364 String type = key->getType();
365 365
366 DEFINE_STATIC_LOCAL(String, s_number, ("number")); 366 DEFINE_STATIC_LOCAL(String, s_number, ("number"));
367 DEFINE_STATIC_LOCAL(String, s_string, ("string")); 367 DEFINE_STATIC_LOCAL(String, s_string, ("string"));
368 DEFINE_STATIC_LOCAL(String, s_date, ("date")); 368 DEFINE_STATIC_LOCAL(String, s_date, ("date"));
369 DEFINE_STATIC_LOCAL(String, s_array, ("array")); 369 DEFINE_STATIC_LOCAL(String, s_array, ("array"));
370 370
371 if (type == s_number) { 371 if (type == s_number) {
372 if (!key->hasNumber()) 372 if (!key->hasNumber())
(...skipping 23 matching lines...) Expand all
396 static IDBKeyRange* idbKeyRangeFromKeyRange(protocol::IndexedDB::KeyRange* keyRa nge) 396 static IDBKeyRange* idbKeyRangeFromKeyRange(protocol::IndexedDB::KeyRange* keyRa nge)
397 { 397 {
398 IDBKey* idbLower = idbKeyFromInspectorObject(keyRange->getLower(nullptr)); 398 IDBKey* idbLower = idbKeyFromInspectorObject(keyRange->getLower(nullptr));
399 if (keyRange->hasLower() && !idbLower) 399 if (keyRange->hasLower() && !idbLower)
400 return nullptr; 400 return nullptr;
401 401
402 IDBKey* idbUpper = idbKeyFromInspectorObject(keyRange->getUpper(nullptr)); 402 IDBKey* idbUpper = idbKeyFromInspectorObject(keyRange->getUpper(nullptr));
403 if (keyRange->hasUpper() && !idbUpper) 403 if (keyRange->hasUpper() && !idbUpper)
404 return nullptr; 404 return nullptr;
405 405
406 if (!keyRange->hasLowerOpen())
407 return nullptr;
408 IDBKeyRange::LowerBoundType lowerBoundType = keyRange->getLowerOpen() ? IDBK eyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed; 406 IDBKeyRange::LowerBoundType lowerBoundType = keyRange->getLowerOpen() ? IDBK eyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed;
409
410 if (!keyRange->hasUpperOpen())
411 return nullptr;
412 IDBKeyRange::UpperBoundType upperBoundType = keyRange->getUpperOpen() ? IDBK eyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed; 407 IDBKeyRange::UpperBoundType upperBoundType = keyRange->getUpperOpen() ? IDBK eyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed;
413
414 return IDBKeyRange::create(idbLower, idbUpper, lowerBoundType, upperBoundTyp e); 408 return IDBKeyRange::create(idbLower, idbUpper, lowerBoundType, upperBoundTyp e);
415 } 409 }
416 410
417 class DataLoader; 411 class DataLoader;
418 412
419 class OpenCursorCallback final : public EventListener { 413 class OpenCursorCallback final : public EventListener {
420 public: 414 public:
421 static PassRefPtrWillBeRawPtr<OpenCursorCallback> create(ScriptState* script State, PassRefPtr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize) 415 static PassRefPtrWillBeRawPtr<OpenCursorCallback> create(ScriptState* script State, PassRefPtr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize)
422 { 416 {
423 return adoptRefWillBeNoop(new OpenCursorCallback(scriptState, requestCal lback, skipCount, pageSize)); 417 return adoptRefWillBeNoop(new OpenCursorCallback(scriptState, requestCal lback, skipCount, pageSize));
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName ); 819 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName );
826 } 820 }
827 821
828 DEFINE_TRACE(InspectorIndexedDBAgent) 822 DEFINE_TRACE(InspectorIndexedDBAgent)
829 { 823 {
830 visitor->trace(m_inspectedFrames); 824 visitor->trace(m_inspectedFrames);
831 InspectorBaseAgent::trace(visitor); 825 InspectorBaseAgent::trace(visitor);
832 } 826 }
833 827
834 } // namespace blink 828 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698