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

Side by Side Diff: Source/WebCore/bindings/v8/V8Proxy.cpp

Issue 6324018: Merge 76786 - 2011-01-27 Yury Semikhatsky <yurys@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « no previous file | 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) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 void V8Proxy::reportUnsafeAccessTo(Frame* target) 148 void V8Proxy::reportUnsafeAccessTo(Frame* target)
149 { 149 {
150 ASSERT(target); 150 ASSERT(target);
151 Document* targetDocument = target->document(); 151 Document* targetDocument = target->document();
152 if (!targetDocument) 152 if (!targetDocument)
153 return; 153 return;
154 154
155 Frame* source = V8Proxy::retrieveFrameForEnteredContext(); 155 Frame* source = V8Proxy::retrieveFrameForEnteredContext();
156 if (!source || !source->document()) 156 if (!source)
157 return; // Ignore error if the source document is gone. 157 return;
158 Page* page = source->page();
159 if (!page)
160 return;
158 161
159 Document* sourceDocument = source->document(); 162 Document* sourceDocument = source->document();
163 if (!sourceDocument)
164 return; // Ignore error if the source document is gone.
160 165
161 // FIXME: This error message should contain more specifics of why the same 166 // FIXME: This error message should contain more specifics of why the same
162 // origin check has failed. 167 // origin check has failed.
163 String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(), 168 String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(),
164 " from frame with URL ", sourceDocument->url().strin g(), ". Domains, protocols and ports must match.\n"); 169 " from frame with URL ", sourceDocument->url().strin g(), ". Domains, protocols and ports must match.\n");
165 170
166 // Build a console message with fake source ID and line number. 171 // Build a console message with fake source ID and line number.
167 const String kSourceID = ""; 172 const String kSourceID = "";
168 const int kLineNumber = 1; 173 const int kLineNumber = 1;
169 174
170 // NOTE: Safari prints the message in the target page, but it seems like 175 // NOTE: Safari prints the message in the target page, but it seems like
171 // it should be in the source page. Even for delayed messages, we put it in 176 // it should be in the source page. Even for delayed messages, we put it in
172 // the source page. 177 // the source page.
173 addMessageToConsole(source->page(), str, kSourceID, kLineNumber); 178 addMessageToConsole(page, str, kSourceID, kLineNumber);
174 } 179 }
175 180
176 static void handleFatalErrorInV8() 181 static void handleFatalErrorInV8()
177 { 182 {
178 // FIXME: We temporarily deal with V8 internal error situations 183 // FIXME: We temporarily deal with V8 internal error situations
179 // such as out-of-memory by crashing the renderer. 184 // such as out-of-memory by crashing the renderer.
180 CRASH(); 185 CRASH();
181 } 186 }
182 187
183 V8Proxy::V8Proxy(Frame* frame) 188 V8Proxy::V8Proxy(Frame* frame)
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 #if ENABLE(WORKERS) 826 #if ENABLE(WORKERS)
822 } else if (context->isWorkerContext()) { 827 } else if (context->isWorkerContext()) {
823 if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(con text)->script()->proxy()) 828 if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(con text)->script()->proxy())
824 return proxy->context(); 829 return proxy->context();
825 #endif 830 #endif
826 } 831 }
827 return v8::Local<v8::Context>(); 832 return v8::Local<v8::Context>();
828 } 833 }
829 834
830 } // namespace WebCore 835 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698