| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Update document object of the frame. | 65 // Update document object of the frame. |
| 66 void updateDocument(); | 66 void updateDocument(); |
| 67 | 67 |
| 68 void namedItemAdded(HTMLDocument*, const AtomicString&); | 68 void namedItemAdded(HTMLDocument*, const AtomicString&); |
| 69 void namedItemRemoved(HTMLDocument*, const AtomicString&); | 69 void namedItemRemoved(HTMLDocument*, const AtomicString&); |
| 70 | 70 |
| 71 // Update the security origin of a document | 71 // Update the security origin of a document |
| 72 // (e.g., after setting docoument.domain). | 72 // (e.g., after setting docoument.domain). |
| 73 void updateSecurityOrigin(SecurityOrigin*); | 73 void updateSecurityOrigin(SecurityOrigin*); |
| 74 | 74 |
| 75 bool isContextInitialized() { | |
| 76 return m_scriptState && !!m_scriptState->perContextData(); | |
| 77 } | |
| 78 void initializeIfNeeded(); | 75 void initializeIfNeeded(); |
| 79 | 76 |
| 80 void clearForNavigation(); | 77 void clearForNavigation(); |
| 81 void clearForClose(); | 78 void clearForClose(); |
| 82 | 79 |
| 83 v8::Local<v8::Object> globalIfNotDetached(); | 80 v8::Local<v8::Object> globalIfNotDetached(); |
| 84 v8::Local<v8::Object> releaseGlobal(); | 81 v8::Local<v8::Object> releaseGlobal(); |
| 85 void setGlobal(v8::Local<v8::Object>); | 82 void setGlobal(v8::Local<v8::Object>); |
| 86 | 83 |
| 87 DOMWrapperWorld& world() { return *m_world; } | 84 DOMWrapperWorld& world() { return *m_world; } |
| 88 | 85 |
| 89 private: | 86 private: |
| 87 // A valid transition is from ContextUninitialized to ContextInitialized, |
| 88 // and then ContextDetached. Other transitions are forbidden. |
| 89 enum class Lifecycle { |
| 90 ContextUninitialized, |
| 91 ContextInitialized, |
| 92 ContextDetached, |
| 93 }; |
| 94 |
| 90 WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); | 95 WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); |
| 91 void initialize(); | 96 void initialize(); |
| 92 | 97 |
| 93 enum GlobalDetachmentBehavior { DoNotDetachGlobal, DetachGlobal }; | 98 enum GlobalDetachmentBehavior { DoNotDetachGlobal, DetachGlobal }; |
| 94 void disposeContext(GlobalDetachmentBehavior); | 99 void disposeContext(GlobalDetachmentBehavior); |
| 95 | 100 |
| 96 void setSecurityToken(SecurityOrigin*); | 101 void setSecurityToken(SecurityOrigin*); |
| 97 | 102 |
| 98 // The JavaScript wrapper for the document object is cached on the global | 103 // The JavaScript wrapper for the document object is cached on the global |
| 99 // object for fast access. UpdateDocumentProperty sets the wrapper | 104 // object for fast access. UpdateDocumentProperty sets the wrapper |
| (...skipping 11 matching lines...) Expand all Loading... |
| 111 | 116 |
| 112 // Associates the window wrapper and its prototype chain with the native | 117 // Associates the window wrapper and its prototype chain with the native |
| 113 // DOMWindow object. Also does some more Window-specific initialization. | 118 // DOMWindow object. Also does some more Window-specific initialization. |
| 114 void setupWindowPrototypeChain(); | 119 void setupWindowPrototypeChain(); |
| 115 | 120 |
| 116 Member<Frame> m_frame; | 121 Member<Frame> m_frame; |
| 117 v8::Isolate* m_isolate; | 122 v8::Isolate* m_isolate; |
| 118 RefPtr<ScriptState> m_scriptState; | 123 RefPtr<ScriptState> m_scriptState; |
| 119 RefPtr<DOMWrapperWorld> m_world; | 124 RefPtr<DOMWrapperWorld> m_world; |
| 120 ScopedPersistent<v8::Object> m_globalProxy; | 125 ScopedPersistent<v8::Object> m_globalProxy; |
| 126 Lifecycle m_lifecycle; |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } // namespace blink | 129 } // namespace blink |
| 124 | 130 |
| 125 #endif // WindowProxy_h | 131 #endif // WindowProxy_h |
| OLD | NEW |