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

Side by Side Diff: Source/web/WebDOMFileSystem.cpp

Issue 1181943005: bindings: Adds ASSERTs to check the creation context passed to public APIs. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebDOMError.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return WebFileSystem::TypeTemporary; 109 return WebFileSystem::TypeTemporary;
110 } 110 }
111 } 111 }
112 112
113 WebURL WebDOMFileSystem::rootURL() const 113 WebURL WebDOMFileSystem::rootURL() const
114 { 114 {
115 ASSERT(m_private.get()); 115 ASSERT(m_private.get());
116 return m_private->rootURL(); 116 return m_private->rootURL();
117 } 117 }
118 118
119 v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> /* creati onContext */, v8::Isolate* isolate) 119 v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> creationC ontext, v8::Isolate* isolate)
120 { 120 {
121 // We no longer use |creationContext| because it's often misused and points 121 // We no longer use |creationContext| because it's often misused and points
122 // to a context faked by user script. 122 // to a context faked by user script.
123 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext());
123 if (!m_private.get()) 124 if (!m_private.get())
124 return v8::Local<v8::Value>(); 125 return v8::Local<v8::Value>();
125 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate ); 126 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate );
126 } 127 }
127 128
128 v8::Local<v8::Value> WebDOMFileSystem::createV8Entry( 129 v8::Local<v8::Value> WebDOMFileSystem::createV8Entry(
129 const WebString& path, 130 const WebString& path,
130 EntryType entryType, 131 EntryType entryType,
131 v8::Local<v8::Object> creationContext, 132 v8::Local<v8::Object> creationContext,
132 v8::Isolate* isolate) 133 v8::Isolate* isolate)
133 { 134 {
135 // We no longer use |creationContext| because it's often misused and points
136 // to a context faked by user script.
137 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext());
134 if (!m_private.get()) 138 if (!m_private.get())
135 return v8::Local<v8::Value>(); 139 return v8::Local<v8::Value>();
136 if (entryType == EntryTypeDirectory) 140 if (entryType == EntryTypeDirectory)
137 return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetC urrentContext()->Global(), isolate); 141 return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetC urrentContext()->Global(), isolate);
138 ASSERT(entryType == EntryTypeFile); 142 ASSERT(entryType == EntryTypeFile);
139 return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentCon text()->Global(), isolate); 143 return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentCon text()->Global(), isolate);
140 } 144 }
141 145
142 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem) 146 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem)
143 : m_private(domFileSystem) 147 : m_private(domFileSystem)
144 { 148 {
145 } 149 }
146 150
147 WebDOMFileSystem& WebDOMFileSystem::operator=(DOMFileSystem* domFileSystem) 151 WebDOMFileSystem& WebDOMFileSystem::operator=(DOMFileSystem* domFileSystem)
148 { 152 {
149 m_private = domFileSystem; 153 m_private = domFileSystem;
150 return *this; 154 return *this;
151 } 155 }
152 156
153 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebDOMError.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698