OLD | NEW |
(Empty) | |
| 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. |
| 3 // |
| 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are |
| 6 // met: |
| 7 // |
| 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above |
| 11 // copyright notice, this list of conditions and the following disclaimer |
| 12 // in the documentation and/or other materials provided with the |
| 13 // distribution. |
| 14 // * Neither the name of Google Inc. nor the names of its |
| 15 // contributors may be used to endorse or promote products derived from |
| 16 // this software without specific prior written permission. |
| 17 // |
| 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
| 30 #include "config.h" |
| 31 #include "DartLocation.h" |
| 32 |
| 33 #include "DartDOMWrapper.h" |
| 34 #include "DartUtilities.h" |
| 35 #include "Frame.h" |
| 36 #include "Location.h" |
| 37 |
| 38 namespace WebCore { |
| 39 |
| 40 namespace DartLocationInternal { |
| 41 |
| 42 void hrefSetter(Dart_NativeArguments args) |
| 43 { |
| 44 DartApiScope dartApiScope; |
| 45 Dart_Handle exception; |
| 46 { |
| 47 Location* receiver = DartDOMWrapper::receiver< Location >(args); |
| 48 |
| 49 const ParameterAdapter< String > href(Dart_GetNativeArgument(args, 1)); |
| 50 if (!href.conversionSuccessful()) { |
| 51 exception = href.exception(); |
| 52 goto fail; |
| 53 } |
| 54 |
| 55 DOMWindow* window = DartUtilities::domWindowForCurrentIsolate(); |
| 56 receiver->setHref(href, window, window); |
| 57 return; |
| 58 } |
| 59 |
| 60 fail: |
| 61 Dart_ThrowException(exception); |
| 62 ASSERT_NOT_REACHED(); |
| 63 } |
| 64 |
| 65 void protocolSetter(Dart_NativeArguments args) |
| 66 { |
| 67 // FIXME: proper implementation. |
| 68 DART_UNIMPLEMENTED(); |
| 69 } |
| 70 |
| 71 void hostSetter(Dart_NativeArguments args) |
| 72 { |
| 73 // FIXME: proper implementation. |
| 74 DART_UNIMPLEMENTED(); |
| 75 } |
| 76 |
| 77 void hostnameSetter(Dart_NativeArguments args) |
| 78 { |
| 79 // FIXME: proper implementation. |
| 80 DART_UNIMPLEMENTED(); |
| 81 } |
| 82 |
| 83 void portSetter(Dart_NativeArguments args) |
| 84 { |
| 85 // FIXME: proper implementation. |
| 86 DART_UNIMPLEMENTED(); |
| 87 } |
| 88 |
| 89 void pathnameSetter(Dart_NativeArguments args) |
| 90 { |
| 91 // FIXME: proper implementation. |
| 92 DART_UNIMPLEMENTED(); |
| 93 } |
| 94 |
| 95 void searchSetter(Dart_NativeArguments args) |
| 96 { |
| 97 // FIXME: proper implementation. |
| 98 DART_UNIMPLEMENTED(); |
| 99 } |
| 100 |
| 101 void hashSetter(Dart_NativeArguments args) |
| 102 { |
| 103 // FIXME: proper implementation. |
| 104 DART_UNIMPLEMENTED(); |
| 105 } |
| 106 |
| 107 void assignCallback(Dart_NativeArguments args) |
| 108 { |
| 109 DartApiScope dartApiScope; |
| 110 Dart_Handle exception; |
| 111 { |
| 112 Location* receiver = DartDOMWrapper::receiver< Location >(args); |
| 113 const ParameterAdapter< String > url(Dart_GetNativeArgument(args, 1)); |
| 114 if (!url.conversionSuccessful()) { |
| 115 exception = url.exception(); |
| 116 goto fail; |
| 117 } |
| 118 |
| 119 DOMWindow* window = receiver->frame()->existingDOMWindow(); |
| 120 ASSERT(window == DartUtilities::domWindowForCurrentIsolate()); |
| 121 receiver->assign(url, window, window); |
| 122 return; |
| 123 } |
| 124 |
| 125 fail: |
| 126 Dart_ThrowException(exception); |
| 127 ASSERT_NOT_REACHED(); |
| 128 } |
| 129 |
| 130 void replaceCallback(Dart_NativeArguments args) |
| 131 { |
| 132 // FIXME: proper implementation. |
| 133 DART_UNIMPLEMENTED(); |
| 134 } |
| 135 |
| 136 void reloadCallback(Dart_NativeArguments args) |
| 137 { |
| 138 // FIXME: proper implementation. |
| 139 DART_UNIMPLEMENTED(); |
| 140 } |
| 141 |
| 142 void toStringCallback(Dart_NativeArguments args) |
| 143 { |
| 144 DartApiScope dartApiScope; |
| 145 { |
| 146 Location* receiver = DartDOMWrapper::receiver< Location >(args); |
| 147 |
| 148 DartDOMWrapper::returnValue(args, receiver->href()); |
| 149 return; |
| 150 } |
| 151 } |
| 152 |
| 153 void valueOfCallback(Dart_NativeArguments args) |
| 154 { |
| 155 // FIXME: proper implementation. |
| 156 DART_UNIMPLEMENTED(); |
| 157 } |
| 158 |
| 159 } |
| 160 |
| 161 } |
OLD | NEW |