Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Side by Side Diff: Source/core/inspector/InjectedScriptModule.cpp

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 21 matching lines...) Expand all
32 #include "core/inspector/InjectedScriptModule.h" 32 #include "core/inspector/InjectedScriptModule.h"
33 33
34 #include "bindings/v8/ScriptFunctionCall.h" 34 #include "bindings/v8/ScriptFunctionCall.h"
35 #include "bindings/v8/ScriptObject.h" 35 #include "bindings/v8/ScriptObject.h"
36 #include "core/inspector/InjectedScript.h" 36 #include "core/inspector/InjectedScript.h"
37 #include "core/inspector/InjectedScriptManager.h" 37 #include "core/inspector/InjectedScriptManager.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 InjectedScriptModule::InjectedScriptModule(const String& name) 41 InjectedScriptModule::InjectedScriptModule(const String& name)
42 : InjectedScriptBase(name) 42 : V8InjectedScriptBase(name)
43 { 43 {
44 } 44 }
45 45
46 void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptM anager, ScriptState* scriptState) 46 void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptM anager, ScriptState* scriptState)
47 { 47 {
48 InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scr iptState); 48 InjectedScript& injectedScriptRaw = injectedScriptManager->injectedScriptFor (scriptState);
49 ASSERT(!injectedScript.isEmpty()); 49 ASSERT(!injectedScriptRaw.isEmpty());
50 if (injectedScript.isEmpty()) 50 if (injectedScriptRaw.isEmpty())
51 return; 51 return;
52 52
53 // FIXME: Make the InjectedScript a module itself. 53 ASSERT(injectedScriptRaw.isJavaScript());
54 if (!injectedScriptRaw.isJavaScript())
55 return;
56 V8InjectedScript& injectedScript = static_cast<V8InjectedScript&>(injectedSc riptRaw);
57
58 // FIXME: Make the V8InjectedScript a module itself.
54 ScriptFunctionCall function(injectedScript.injectedScriptObject(), "module") ; 59 ScriptFunctionCall function(injectedScript.injectedScriptObject(), "module") ;
55 function.appendArgument(name()); 60 function.appendArgument(name());
56 bool hadException = false; 61 bool hadException = false;
57 ScriptValue resultValue = injectedScript.callFunctionWithEvalEnabled(functio n, hadException); 62 ScriptValue resultValue = injectedScript.callFunctionWithEvalEnabled(functio n, hadException);
58 ASSERT(!hadException); 63 ASSERT(!hadException);
59 V8ScriptState::Scope scope(scriptState->v8ScriptState()); 64 V8ScriptState::Scope scope(scriptState->v8ScriptState());
60 if (hadException || resultValue.isEmpty() || !resultValue.isObject()) { 65 if (hadException || resultValue.isEmpty() || !resultValue.isObject()) {
61 ScriptFunctionCall function(injectedScript.injectedScriptObject(), "inje ctModule"); 66 ScriptFunctionCall function(injectedScript.injectedScriptObject(), "inje ctModule");
62 function.appendArgument(name()); 67 function.appendArgument(name());
63 function.appendArgument(source()); 68 function.appendArgument(source());
64 resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadEx ception); 69 resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadEx ception);
65 if (hadException || resultValue.isEmpty() || !resultValue.isObject()) { 70 if (hadException || resultValue.isEmpty() || !resultValue.isObject()) {
66 ASSERT_NOT_REACHED(); 71 ASSERT_NOT_REACHED();
67 return; 72 return;
68 } 73 }
69 } 74 }
70 75
71 ScriptObject moduleObject(scriptState, resultValue); 76 ScriptObject moduleObject(scriptState, resultValue);
72 initialize(moduleObject, injectedScriptManager->inspectedStateAccessCheck()) ; 77 initialize(moduleObject, injectedScriptManager->inspectedStateAccessCheck()) ;
73 } 78 }
74 79
75 } // namespace WebCore 80 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InjectedScriptModule.h ('k') | Source/core/inspector/InjectedScriptSource.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698