OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 typedef String ErrorString; | 44 typedef String ErrorString; |
45 | 45 |
46 | 46 |
47 class InjectedScriptBase { | 47 class InjectedScriptBase { |
48 public: | 48 public: |
49 virtual ~InjectedScriptBase() { } | 49 virtual ~InjectedScriptBase() { } |
50 | 50 |
51 const String& name() const { return m_name; } | 51 const String& name() const { return m_name; } |
52 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } | 52 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } |
53 ScriptState* scriptState() const { return m_injectedScriptObject.scriptState
(); } | 53 ScriptState* scriptState() const |
| 54 { |
| 55 ASSERT(!isEmpty()); |
| 56 return m_injectedScriptObject.scriptState(); |
| 57 } |
54 | 58 |
55 protected: | 59 protected: |
56 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 60 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
57 InjectedScriptBase(const String& name); | 61 InjectedScriptBase(const String& name); |
58 InjectedScriptBase(const String& name, ScriptValue, InspectedStateAccessChec
k); | 62 InjectedScriptBase(const String& name, ScriptValue, InspectedStateAccessChec
k); |
59 | 63 |
60 void initialize(ScriptValue, InspectedStateAccessCheck); | 64 void initialize(ScriptValue, InspectedStateAccessCheck); |
61 bool canAccessInspectedWindow() const; | 65 bool canAccessInspectedWindow() const; |
62 const ScriptValue& injectedScriptObject() const; | 66 const ScriptValue& injectedScriptObject() const; |
63 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; | 67 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; |
64 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 68 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
65 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); | 69 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); |
66 | 70 |
67 private: | 71 private: |
68 String m_name; | 72 String m_name; |
69 ScriptValue m_injectedScriptObject; | 73 ScriptValue m_injectedScriptObject; |
70 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 74 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
71 }; | 75 }; |
72 | 76 |
73 | 77 |
74 } // namespace WebCore | 78 } // namespace WebCore |
75 | 79 |
76 #endif | 80 #endif |
OLD | NEW |