OLD | NEW |
1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
2 // All rights reserved. | 2 // 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 goto fail; | 116 goto fail; |
117 | 117 |
118 DartStringAdapter originArg = DartUtilities::dartToString(args, 5, excep
tion); | 118 DartStringAdapter originArg = DartUtilities::dartToString(args, 5, excep
tion); |
119 if (exception) | 119 if (exception) |
120 goto fail; | 120 goto fail; |
121 | 121 |
122 DartStringAdapter lastEventIdArg = DartUtilities::dartToString(args, 6,
exception); | 122 DartStringAdapter lastEventIdArg = DartUtilities::dartToString(args, 6,
exception); |
123 if (exception) | 123 if (exception) |
124 goto fail; | 124 goto fail; |
125 | 125 |
126 LocalDOMWindow* sourceArg = DartWindow::toNative(Dart_GetNativeArgument(
args, 7), exception); | 126 LocalDOMWindow* sourceArg = DartWindow::toNativeWithNullCheck(Dart_GetNa
tiveArgument(args, 7), exception); |
127 if (exception) | 127 if (exception) |
128 goto fail; | 128 goto fail; |
129 | 129 |
130 OwnPtr<MessagePortArray> portArray; | 130 OwnPtr<MessagePortArray> portArray; |
131 if (!Dart_IsNull(Dart_GetNativeArgument(args, 8))) { | 131 if (!Dart_IsNull(Dart_GetNativeArgument(args, 8))) { |
132 portArray = adoptPtr(new MessagePortArray); | 132 portArray = adoptPtr(new MessagePortArray); |
133 ArrayBufferArray bufferArray; | 133 ArrayBufferArray bufferArray; |
134 DartUtilities::toMessagePortArray(Dart_GetNativeArgument(args, 8), *
portArray, bufferArray, exception); | 134 DartUtilities::toMessagePortArray(Dart_GetNativeArgument(args, 8), *
portArray, bufferArray, exception); |
135 if (exception) | 135 if (exception) |
136 goto fail; | 136 goto fail; |
137 if (bufferArray.size() > 0) { | 137 if (bufferArray.size() > 0) { |
138 exception = Dart_NewStringFromCString("MessagePortArray argument
must contain only MessagePorts"); | 138 exception = Dart_NewStringFromCString("MessagePortArray argument
must contain only MessagePorts"); |
139 goto fail; | 139 goto fail; |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 receiver->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg
, originArg, lastEventIdArg, sourceArg, portArray.release()); | 143 receiver->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg
, originArg, lastEventIdArg, sourceArg, portArray.release()); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 fail: | 147 fail: |
148 Dart_ThrowException(exception); | 148 Dart_ThrowException(exception); |
149 ASSERT_NOT_REACHED(); | 149 ASSERT_NOT_REACHED(); |
150 } | 150 } |
151 | 151 |
152 } | 152 } |
153 | 153 |
154 } | 154 } |
OLD | NEW |