| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014, 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 "bindings/core/dart/DartInjectedScriptHost.h" |
| 32 |
| 33 #include "bindings/core/dart/DartDOMWrapper.h" |
| 34 #include "bindings/core/dart/DartHandleProxy.h" |
| 35 #include "bindings/core/dart/DartInjectedScript.h" |
| 36 #include "bindings/core/dart/DartInjectedScriptManager.h" |
| 37 #include "bindings/core/dart/DartNode.h" |
| 38 #include "bindings/core/dart/DartScriptDebugServer.h" |
| 39 #include "bindings/core/dart/V8Converter.h" |
| 40 #include "core/events/EventTarget.h" |
| 41 #include "core/frame/LocalDOMWindow.h" |
| 42 #include "core/inspector/InjectedScript.h" |
| 43 #include "core/inspector/InjectedScriptHost.h" |
| 44 #include "core/inspector/InjectedScriptManager.h" |
| 45 #include "core/inspector/InspectorDOMAgent.h" |
| 46 #include "modules/webdatabase/Database.h" |
| 47 #include "platform/JSONValues.h" |
| 48 |
| 49 namespace blink { |
| 50 |
| 51 namespace DartInjectedScriptHostInternal { |
| 52 |
| 53 void inspectCallback(Dart_NativeArguments args) |
| 54 { |
| 55 Dart_Handle exception = 0; |
| 56 { |
| 57 InjectedScriptHost* receiver = DartDOMWrapper::receiver< InjectedScriptH
ost >(args); |
| 58 Dart_Handle object = Dart_GetNativeArgument(args, 1); |
| 59 |
| 60 // Inspect is only allowed for nodes. |
| 61 if (DartDOMWrapper::subtypeOf(object, DartNode::dartClassId)) { |
| 62 Node* node = DartNode::toNative(object, exception); |
| 63 if (exception) |
| 64 goto fail; |
| 65 |
| 66 Document* document = node->isDocumentNode() ? &node->document() : no
de->ownerDocument(); |
| 67 LocalFrame* frame = document ? document->frame() : 0; |
| 68 DartInjectedScriptManager* dartInjectedScriptManager = DartScriptDeb
ugServer::shared().injectedScriptManager(); |
| 69 if (!dartInjectedScriptManager) { |
| 70 // This should not happen but is possible if inspect is somehow |
| 71 // called before the devtools are opened. |
| 72 exception = Dart_NewApiError("Inspect failed due to an internal
error"); |
| 73 return; |
| 74 } |
| 75 InjectedScriptManager* injectedScriptManager = dartInjectedScriptMan
ager->javaScriptInjectedScriptManager(); |
| 76 InjectedScript injectedScript = injectedScriptManager->injectedScrip
tFor(V8ScriptState::forMainWorld(frame)); |
| 77 |
| 78 // FIXME: read in the hint argument as well. |
| 79 ASSERT(!Dart_IsError(object)); |
| 80 receiver->inspectImpl(injectedScript.wrapNode(node, ""), |
| 81 JSONObject::create()); |
| 82 |
| 83 if (exception) |
| 84 goto fail; |
| 85 } else { |
| 86 exception = Dart_NewApiError("Inspect only allowed for nodes."); |
| 87 } |
| 88 return; |
| 89 } |
| 90 |
| 91 fail: |
| 92 Dart_ThrowException(exception); |
| 93 } |
| 94 |
| 95 void inspectedObjectCallback(Dart_NativeArguments args) |
| 96 { |
| 97 // FIXME: proper implementation. |
| 98 DART_UNIMPLEMENTED(); |
| 99 } |
| 100 |
| 101 void internalConstructorNameCallback(Dart_NativeArguments args) |
| 102 { |
| 103 // FIXME: proper implementation. |
| 104 DART_UNIMPLEMENTED(); |
| 105 } |
| 106 |
| 107 void isHTMLAllCollectionCallback(Dart_NativeArguments args) |
| 108 { |
| 109 // FIXME: proper implementation. |
| 110 DART_UNIMPLEMENTED(); |
| 111 } |
| 112 |
| 113 void typeCallback(Dart_NativeArguments args) |
| 114 { |
| 115 // FIXME: proper implementation. |
| 116 DART_UNIMPLEMENTED(); |
| 117 } |
| 118 |
| 119 void functionDetailsCallback(Dart_NativeArguments args) |
| 120 { |
| 121 // FIXME: proper implementation. |
| 122 DART_UNIMPLEMENTED(); |
| 123 } |
| 124 |
| 125 void getInternalPropertiesCallback(Dart_NativeArguments args) |
| 126 { |
| 127 // FIXME: proper implementation. |
| 128 DART_UNIMPLEMENTED(); |
| 129 } |
| 130 |
| 131 void getEventListenersCallback(Dart_NativeArguments args) |
| 132 { |
| 133 // FIXME: proper implementation. |
| 134 DART_UNIMPLEMENTED(); |
| 135 } |
| 136 |
| 137 void evaluateWithExceptionDetailsCallback(Dart_NativeArguments args) |
| 138 { |
| 139 // FIXME: proper implementation. |
| 140 DART_UNIMPLEMENTED(); |
| 141 } |
| 142 |
| 143 void debugFunctionCallback(Dart_NativeArguments args) |
| 144 { |
| 145 // FIXME: proper implementation. |
| 146 DART_UNIMPLEMENTED(); |
| 147 } |
| 148 |
| 149 void undebugFunctionCallback(Dart_NativeArguments args) |
| 150 { |
| 151 // FIXME: proper implementation. |
| 152 DART_UNIMPLEMENTED(); |
| 153 } |
| 154 |
| 155 void monitorFunctionCallback(Dart_NativeArguments args) |
| 156 { |
| 157 // FIXME: proper implementation. |
| 158 DART_UNIMPLEMENTED(); |
| 159 } |
| 160 |
| 161 void unmonitorFunctionCallback(Dart_NativeArguments args) |
| 162 { |
| 163 // FIXME: proper implementation. |
| 164 DART_UNIMPLEMENTED(); |
| 165 } |
| 166 |
| 167 void suppressWarningsAndCallCallback(Dart_NativeArguments args) |
| 168 { |
| 169 // FIXME: proper implementation. |
| 170 DART_UNIMPLEMENTED(); |
| 171 } |
| 172 |
| 173 void setFunctionVariableValueCallback(Dart_NativeArguments args) |
| 174 { |
| 175 // FIXME: proper implementation. |
| 176 DART_UNIMPLEMENTED(); |
| 177 } |
| 178 |
| 179 void evalCallback(Dart_NativeArguments args) |
| 180 { |
| 181 // FIXME: proper implementation. |
| 182 DART_UNIMPLEMENTED(); |
| 183 } |
| 184 |
| 185 void callFunctionCallback(Dart_NativeArguments args) |
| 186 { |
| 187 // FIXME: proper implementation. |
| 188 DART_UNIMPLEMENTED(); |
| 189 } |
| 190 |
| 191 void suppressWarningsAndCallFunctionCallback(Dart_NativeArguments args) |
| 192 { |
| 193 // FIXME: proper implementation. |
| 194 DART_UNIMPLEMENTED(); |
| 195 } |
| 196 |
| 197 } |
| 198 |
| 199 } // namespace blink |
| OLD | NEW |