Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 28 matching lines...) Expand all Loading... | |
| 39 #include "wtf/ArrayBuffer.h" | 39 #include "wtf/ArrayBuffer.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 void V8DedicatedWorkerGlobalScope::postMessageMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& args) | 43 void V8DedicatedWorkerGlobalScope::postMessageMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& args) |
| 44 { | 44 { |
| 45 DedicatedWorkerGlobalScope* workerGlobalScope = V8DedicatedWorkerGlobalScope ::toNative(args.Holder()); | 45 DedicatedWorkerGlobalScope* workerGlobalScope = V8DedicatedWorkerGlobalScope ::toNative(args.Holder()); |
| 46 MessagePortArray ports; | 46 MessagePortArray ports; |
| 47 ArrayBufferArray arrayBuffers; | 47 ArrayBufferArray arrayBuffers; |
| 48 if (args.Length() > 1) { | 48 if (args.Length() > 1) { |
| 49 if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate( ))) | 49 if (!extractTransferables(args[1], ports, arrayBuffers, |
| 50 args.GetIsolate(), "Second argument is not a sequence type")) | |
|
Mike West
2013/10/21 06:51:22
Two things:
1. Can you bring in ExceptionMessages
| |
| 50 return; | 51 return; |
| 51 } | 52 } |
| 52 bool didThrow = false; | 53 bool didThrow = false; |
| 53 RefPtr<SerializedScriptValue> message = | 54 RefPtr<SerializedScriptValue> message = |
| 54 SerializedScriptValue::create(args[0], | 55 SerializedScriptValue::create(args[0], |
| 55 &ports, | 56 &ports, |
| 56 &arrayBuffers, | 57 &arrayBuffers, |
| 57 didThrow, | 58 didThrow, |
| 58 args.GetIsolate()); | 59 args.GetIsolate()); |
| 59 if (didThrow) | 60 if (didThrow) |
| 60 return; | 61 return; |
| 61 ExceptionState es(args.GetIsolate()); | 62 ExceptionState es(args.GetIsolate()); |
| 62 workerGlobalScope->postMessage(message.release(), &ports, es); | 63 workerGlobalScope->postMessage(message.release(), &ports, es); |
| 63 es.throwIfNeeded(); | 64 es.throwIfNeeded(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // namespace WebCore | 67 } // namespace WebCore |
| OLD | NEW |