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

Side by Side Diff: Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

Issue 8883032: Merge 102317 - https://bugs.webkit.org/show_bug.cgi?id=74038 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 9 years 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 | « Source/WebCore/ChangeLog ('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) 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2011 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], fal se, ListenerFindOnly); 279 RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], fal se, ListenerFindOnly);
280 280
281 if (listener) { 281 if (listener) {
282 imp->removeEventListener(eventType, listener.get(), useCapture); 282 imp->removeEventListener(eventType, listener.get(), useCapture);
283 removeHiddenDependency(args.Holder(), args[1], eventListenerCacheIndex); 283 removeHiddenDependency(args.Holder(), args[1], eventListenerCacheIndex);
284 } 284 }
285 285
286 return v8::Undefined(); 286 return v8::Undefined();
287 } 287 }
288 288
289 static bool isLegacyTargetOriginDesignation(v8::Handle<v8::Value> value)
290 {
291 if (value->IsString() || value->IsStringObject())
292 return true;
293 return false;
294 }
295
296
289 static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args , bool extendedTransfer) 297 static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args , bool extendedTransfer)
290 { 298 {
291 DOMWindow* window = V8DOMWindow::toNative(args.Holder()); 299 DOMWindow* window = V8DOMWindow::toNative(args.Holder());
292 300
293 DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow(); 301 DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow();
294 ASSERT(source->frame()); 302 ASSERT(source->frame());
295 303
296 // This function has variable arguments and can either be: 304 // This function has variable arguments and can be:
297 // postMessage(message, port, targetOrigin); 305 // Per current spec:
298 // or 306 // postMessage(message, targetOrigin)
299 // postMessage(message, targetOrigin); 307 // postMessage(message, targetOrigin, {sequence of transferrables})
308 // Legacy non-standard implementations in webkit allowed:
309 // postMessage(message, {sequence of transferrables}, targetOrigin);
300 MessagePortArray portArray; 310 MessagePortArray portArray;
301 ArrayBufferArray arrayBufferArray; 311 ArrayBufferArray arrayBufferArray;
302 String targetOrigin; 312 String targetOrigin;
303 { 313 {
304 v8::TryCatch tryCatch; 314 v8::TryCatch tryCatch;
315 int targetOriginArgIndex = 1;
305 if (args.Length() > 2) { 316 if (args.Length() > 2) {
306 if (!extractTransferables(args[2], portArray, arrayBufferArray)) 317 int transferablesArgIndex = 2;
318 if (isLegacyTargetOriginDesignation(args[2])) {
319 targetOriginArgIndex = 2;
320 transferablesArgIndex = 1;
321 }
322 if (!extractTransferables(args[transferablesArgIndex], portArray, ar rayBufferArray))
307 return v8::Undefined(); 323 return v8::Undefined();
308 } 324 }
309 targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[1]); 325 targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[targetOrigin ArgIndex]);
310 326
311 if (tryCatch.HasCaught()) 327 if (tryCatch.HasCaught())
312 return v8::Undefined(); 328 return v8::Undefined();
313 } 329 }
314 330
315 331
316 bool didThrow = false; 332 bool didThrow = false;
317 RefPtr<SerializedScriptValue> message = 333 RefPtr<SerializedScriptValue> message =
318 SerializedScriptValue::create(args[0], 334 SerializedScriptValue::create(args[0],
319 &portArray, 335 &portArray,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 v8::Handle<v8::Context> context = V8Proxy::context(frame); 621 v8::Handle<v8::Context> context = V8Proxy::context(frame);
606 if (context.IsEmpty()) 622 if (context.IsEmpty())
607 return v8::Handle<v8::Object>(); 623 return v8::Handle<v8::Object>();
608 624
609 v8::Handle<v8::Object> global = context->Global(); 625 v8::Handle<v8::Object> global = context->Global();
610 ASSERT(!global.IsEmpty()); 626 ASSERT(!global.IsEmpty());
611 return global; 627 return global;
612 } 628 }
613 629
614 } // namespace WebCore 630 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698