| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 , m_requestState(toIsolate(context)) | 71 , m_requestState(toIsolate(context)) |
| 72 { | 72 { |
| 73 ScriptWrappable::init(this); | 73 ScriptWrappable::init(this); |
| 74 } | 74 } |
| 75 | 75 |
| 76 IDBRequest::~IDBRequest() | 76 IDBRequest::~IDBRequest() |
| 77 { | 77 { |
| 78 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionConte
xt()); | 78 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionConte
xt()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 ScriptValue IDBRequest::result(ExceptionState& exceptionState) | 81 ScriptValue IDBRequest::result(NewScriptState* scriptState, ExceptionState& exce
ptionState) |
| 82 { | 82 { |
| 83 if (m_readyState != DONE) { | 83 if (m_readyState != DONE) { |
| 84 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request
NotFinishedErrorMessage); | 84 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request
NotFinishedErrorMessage); |
| 85 return ScriptValue(); | 85 return ScriptValue(); |
| 86 } | 86 } |
| 87 if (m_contextStopped || !executionContext()) | 87 if (m_contextStopped || !executionContext()) |
| 88 return ScriptValue(); | 88 return ScriptValue(); |
| 89 m_resultDirty = false; | 89 m_resultDirty = false; |
| 90 return idbAnyToScriptValue(&m_requestState, m_result); | 90 return idbAnyToScriptValue(scriptState, m_result); |
| 91 } | 91 } |
| 92 | 92 |
| 93 PassRefPtrWillBeRawPtr<DOMError> IDBRequest::error(ExceptionState& exceptionStat
e) const | 93 PassRefPtrWillBeRawPtr<DOMError> IDBRequest::error(ExceptionState& exceptionStat
e) const |
| 94 { | 94 { |
| 95 if (m_readyState != DONE) { | 95 if (m_readyState != DONE) { |
| 96 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request
NotFinishedErrorMessage); | 96 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request
NotFinishedErrorMessage); |
| 97 return nullptr; | 97 return nullptr; |
| 98 } | 98 } |
| 99 return m_error; | 99 return m_error; |
| 100 } | 100 } |
| 101 | 101 |
| 102 ScriptValue IDBRequest::source(ExecutionContext* context) const | 102 ScriptValue IDBRequest::source(NewScriptState* scriptState) const |
| 103 { | 103 { |
| 104 if (m_contextStopped || !executionContext()) | 104 if (m_contextStopped || !executionContext()) |
| 105 return ScriptValue(); | 105 return ScriptValue(); |
| 106 | 106 |
| 107 DOMRequestState requestState(toIsolate(context)); | 107 return idbAnyToScriptValue(scriptState, m_source); |
| 108 return idbAnyToScriptValue(&requestState, m_source); | |
| 109 } | 108 } |
| 110 | 109 |
| 111 const String& IDBRequest::readyState() const | 110 const String& IDBRequest::readyState() const |
| 112 { | 111 { |
| 113 ASSERT(m_readyState == PENDING || m_readyState == DONE); | 112 ASSERT(m_readyState == PENDING || m_readyState == DONE); |
| 114 DEFINE_STATIC_LOCAL(AtomicString, pending, ("pending", AtomicString::Constru
ctFromLiteral)); | 113 DEFINE_STATIC_LOCAL(AtomicString, pending, ("pending", AtomicString::Constru
ctFromLiteral)); |
| 115 DEFINE_STATIC_LOCAL(AtomicString, done, ("done", AtomicString::ConstructFrom
Literal)); | 114 DEFINE_STATIC_LOCAL(AtomicString, done, ("done", AtomicString::ConstructFrom
Literal)); |
| 116 | 115 |
| 117 if (m_readyState == PENDING) | 116 if (m_readyState == PENDING) |
| 118 return pending; | 117 return pending; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 520 |
| 522 void IDBRequest::dequeueEvent(Event* event) | 521 void IDBRequest::dequeueEvent(Event* event) |
| 523 { | 522 { |
| 524 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 523 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| 525 if (m_enqueuedEvents[i].get() == event) | 524 if (m_enqueuedEvents[i].get() == event) |
| 526 m_enqueuedEvents.remove(i); | 525 m_enqueuedEvents.remove(i); |
| 527 } | 526 } |
| 528 } | 527 } |
| 529 | 528 |
| 530 } // namespace WebCore | 529 } // namespace WebCore |
| OLD | NEW |