OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 26 matching lines...) Expand all Loading... |
37 #include "bindings/core/v8/WindowProxy.h" | 37 #include "bindings/core/v8/WindowProxy.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "core/dom/DocumentParser.h" | 39 #include "core/dom/DocumentParser.h" |
40 #include "core/dom/QualifiedName.h" | 40 #include "core/dom/QualifiedName.h" |
41 #include "core/events/EventListener.h" | 41 #include "core/events/EventListener.h" |
42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
43 #include <v8.h> | 43 #include <v8.h> |
44 | 44 |
45 namespace blink { | 45 namespace blink { |
46 | 46 |
47 RawPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const Quali
fiedName& name, const AtomicString& value, const AtomicString& eventParameterNam
e) | 47 V8LazyEventListener* createAttributeEventListener(Node* node, const QualifiedNam
e& name, const AtomicString& value, const AtomicString& eventParameterName) |
48 { | 48 { |
49 ASSERT(node); | 49 ASSERT(node); |
50 if (value.isNull()) | 50 if (value.isNull()) |
51 return nullptr; | 51 return nullptr; |
52 | 52 |
53 // FIXME: Very strange: we initialize zero-based number with '1'. | 53 // FIXME: Very strange: we initialize zero-based number with '1'. |
54 TextPosition position(OrdinalNumber::fromZeroBasedInt(1), OrdinalNumber::fir
st()); | 54 TextPosition position(OrdinalNumber::fromZeroBasedInt(1), OrdinalNumber::fir
st()); |
55 String sourceURL; | 55 String sourceURL; |
56 | 56 |
57 v8::Isolate* isolate; | 57 v8::Isolate* isolate; |
58 if (LocalFrame* frame = node->document().frame()) { | 58 if (LocalFrame* frame = node->document().frame()) { |
59 isolate = toIsolate(frame); | 59 isolate = toIsolate(frame); |
60 ScriptController& scriptController = frame->script(); | 60 ScriptController& scriptController = frame->script(); |
61 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) | 61 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) |
62 return nullptr; | 62 return nullptr; |
63 position = scriptController.eventHandlerPosition(); | 63 position = scriptController.eventHandlerPosition(); |
64 sourceURL = node->document().url().getString(); | 64 sourceURL = node->document().url().getString(); |
65 } else { | 65 } else { |
66 isolate = v8::Isolate::GetCurrent(); | 66 isolate = v8::Isolate::GetCurrent(); |
67 } | 67 } |
68 | 68 |
69 return V8LazyEventListener::create(name.localName(), eventParameterName, val
ue, sourceURL, position, node, isolate); | 69 return V8LazyEventListener::create(name.localName(), eventParameterName, val
ue, sourceURL, position, node, isolate); |
70 } | 70 } |
71 | 71 |
72 RawPtr<V8LazyEventListener> createAttributeEventListener(LocalFrame* frame, cons
t QualifiedName& name, const AtomicString& value, const AtomicString& eventParam
eterName) | 72 V8LazyEventListener* createAttributeEventListener(LocalFrame* frame, const Quali
fiedName& name, const AtomicString& value, const AtomicString& eventParameterNam
e) |
73 { | 73 { |
74 if (!frame) | 74 if (!frame) |
75 return nullptr; | 75 return nullptr; |
76 | 76 |
77 if (value.isNull()) | 77 if (value.isNull()) |
78 return nullptr; | 78 return nullptr; |
79 | 79 |
80 ScriptController& scriptController = frame->script(); | 80 ScriptController& scriptController = frame->script(); |
81 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) | 81 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) |
82 return nullptr; | 82 return nullptr; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 void getFunctionLocation(v8::Local<v8::Function> function, String& scriptId, int
& lineNumber, int& columnNumber) | 117 void getFunctionLocation(v8::Local<v8::Function> function, String& scriptId, int
& lineNumber, int& columnNumber) |
118 { | 118 { |
119 int scriptIdValue = function->ScriptId(); | 119 int scriptIdValue = function->ScriptId(); |
120 scriptId = String::number(scriptIdValue); | 120 scriptId = String::number(scriptIdValue); |
121 lineNumber = function->GetScriptLineNumber(); | 121 lineNumber = function->GetScriptLineNumber(); |
122 columnNumber = function->GetScriptColumnNumber(); | 122 columnNumber = function->GetScriptColumnNumber(); |
123 } | 123 } |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
OLD | NEW |