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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // None of these need to be RefPtr because info and context are guaranteed | 189 // None of these need to be RefPtr because info and context are guaranteed |
190 // to hold on to them. | 190 // to hold on to them. |
191 DOMWindow* window = V8Window::toImpl(info.Holder()); | 191 DOMWindow* window = V8Window::toImpl(info.Holder()); |
192 // TODO(yukishiino): The HTML spec specifies that we should use the | 192 // TODO(yukishiino): The HTML spec specifies that we should use the |
193 // Incumbent Realm instead of the Current Realm, but currently we don't have | 193 // Incumbent Realm instead of the Current Realm, but currently we don't have |
194 // a way to retrieve the Incumbent Realm. See also: | 194 // a way to retrieve the Incumbent Realm. See also: |
195 // https://html.spec.whatwg.org/multipage/comms.html#dom-window-postmessage | 195 // https://html.spec.whatwg.org/multipage/comms.html#dom-window-postmessage |
196 LocalDOMWindow* source = currentDOMWindow(info.GetIsolate()); | 196 LocalDOMWindow* source = currentDOMWindow(info.GetIsolate()); |
197 | 197 |
198 ASSERT(window); | 198 ASSERT(window); |
199 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->frame(), | 199 UseCounter::count(window->frame(), UseCounter::WindowPostMessage); |
200 UseCounter::WindowPostMessage); | |
201 | 200 |
202 // If called directly by WebCore we don't have a calling context. | 201 // If called directly by WebCore we don't have a calling context. |
203 if (!source) { | 202 if (!source) { |
204 exceptionState.throwTypeError("No active calling context exists."); | 203 exceptionState.throwTypeError("No active calling context exists."); |
205 return; | 204 return; |
206 } | 205 } |
207 | 206 |
208 // This function has variable arguments and can be: | 207 // This function has variable arguments and can be: |
209 // postMessage(message, targetOrigin) | 208 // postMessage(message, targetOrigin) |
210 // postMessage(message, targetOrigin, {sequence of transferrables}) | 209 // postMessage(message, targetOrigin, {sequence of transferrables}) |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (items->hasExactlyOneItem()) { | 325 if (items->hasExactlyOneItem()) { |
327 v8SetReturnValueFast(info, items->item(0), window); | 326 v8SetReturnValueFast(info, items->item(0), window); |
328 return; | 327 return; |
329 } | 328 } |
330 v8SetReturnValueFast(info, items, window); | 329 v8SetReturnValueFast(info, items, window); |
331 return; | 330 return; |
332 } | 331 } |
333 } | 332 } |
334 | 333 |
335 } // namespace blink | 334 } // namespace blink |
OLD | NEW |