 Chromium Code Reviews
 Chromium Code Reviews Issue 24139004:
  Add toWebCoreString() / toWebCoreAtomicString() overloads taking a v8::String  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 24139004:
  Add toWebCoreString() / toWebCoreAtomicString() overloads taking a v8::String  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 | 91 | 
| 92 String eventListenerHandlerBody(Document* document, EventListener* listener) | 92 String eventListenerHandlerBody(Document* document, EventListener* listener) | 
| 93 { | 93 { | 
| 94 if (listener->type() != EventListener::JSEventListenerType) | 94 if (listener->type() != EventListener::JSEventListenerType) | 
| 95 return ""; | 95 return ""; | 
| 96 | 96 | 
| 97 v8::HandleScope scope(isolateForScriptExecutionContext(document)); | 97 v8::HandleScope scope(isolateForScriptExecutionContext(document)); | 
| 98 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>( listener); | 98 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>( listener); | 
| 99 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world()) ; | 99 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world()) ; | 
| 100 v8::Context::Scope contextScope(context); | 100 v8::Context::Scope contextScope(context); | 
| 101 v8::Handle<v8::Object> function = v8Listener->getListenerObject(document); | 101 v8::Handle<v8::Value> function = v8Listener->getListenerObject(document); | 
| 102 if (function.IsEmpty()) | 102 if (function.IsEmpty()) | 
| 103 return ""; | 103 return ""; | 
| 104 | 104 | 
| 105 return toWebCoreStringWithNullCheck(function); | 105 return toWebCoreStringWithNullCheck(function); | 
| 106 } | 106 } | 
| 107 | 107 | 
| 108 ScriptValue eventListenerHandler(Document* document, EventListener* listener) | 108 ScriptValue eventListenerHandler(Document* document, EventListener* listener) | 
| 109 { | 109 { | 
| 110 if (listener->type() != EventListener::JSEventListenerType) | 110 if (listener->type() != EventListener::JSEventListenerType) | 
| 111 return ScriptValue(); | 111 return ScriptValue(); | 
| (...skipping 28 matching lines...) Expand all Loading... | |
| 140 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world()) ; | 140 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world()) ; | 
| 141 v8::Context::Scope contextScope(context); | 141 v8::Context::Scope contextScope(context); | 
| 142 v8::Handle<v8::Object> object = v8Listener->getListenerObject(document); | 142 v8::Handle<v8::Object> object = v8Listener->getListenerObject(document); | 
| 143 if (object.IsEmpty() || !object->IsFunction()) | 143 if (object.IsEmpty() || !object->IsFunction()) | 
| 144 return false; | 144 return false; | 
| 145 | 145 | 
| 146 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object); | 146 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object); | 
| 147 v8::Handle<v8::Value> scriptIdValue = function->GetScriptId(); | 147 v8::Handle<v8::Value> scriptIdValue = function->GetScriptId(); | 
| 148 scriptId = toWebCoreStringWithUndefinedOrNullCheck(scriptIdValue); | 148 scriptId = toWebCoreStringWithUndefinedOrNullCheck(scriptIdValue); | 
| 149 v8::ScriptOrigin origin = function->GetScriptOrigin(); | 149 v8::ScriptOrigin origin = function->GetScriptOrigin(); | 
| 150 if (origin.ResourceName()->IsString() && !origin.ResourceName().IsEmpty()) | 150 if (origin.ResourceName()->IsString() && !origin.ResourceName().IsEmpty()) | 
| 
haraken
2013/09/16 12:06:48
Not related to your CL, this check looks silly. We
 
do-not-use
2013/09/16 12:10:30
Right. I'll fix this before landing.
 | |
| 151 sourceName = toWebCoreString(origin.ResourceName()); | 151 sourceName = toWebCoreString(origin.ResourceName().As<v8::String>()); | 
| 152 else | 152 else | 
| 153 sourceName = ""; | 153 sourceName = ""; | 
| 154 lineNumber = function->GetScriptLineNumber(); | 154 lineNumber = function->GetScriptLineNumber(); | 
| 155 return true; | 155 return true; | 
| 156 } | 156 } | 
| 157 | 157 | 
| 158 } // namespace WebCore | 158 } // namespace WebCore | 
| OLD | NEW |