Title: [138442] trunk/Source/WebCore
Revision
138442
Author
[email protected]
Date
2012-12-24 07:59:46 -0800 (Mon, 24 Dec 2012)

Log Message

Web Inspector: Keep LiveEdit API disabled when idle
https://bugs.webkit.org/show_bug.cgi?id=104039

Patch by Peter Rybin <[email protected]> on 2012-12-24
Reviewed by Pavel Feldman.

Guards are added to LiveEdit call

* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::setScriptSource):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138441 => 138442)


--- trunk/Source/WebCore/ChangeLog	2012-12-24 14:03:12 UTC (rev 138441)
+++ trunk/Source/WebCore/ChangeLog	2012-12-24 15:59:46 UTC (rev 138442)
@@ -1,3 +1,15 @@
+2012-12-24  Peter Rybin  <[email protected]>
+
+        Web Inspector: Keep LiveEdit API disabled when idle
+        https://bugs.webkit.org/show_bug.cgi?id=104039
+
+        Reviewed by Pavel Feldman.
+
+        Guards are added to LiveEdit call
+
+        * bindings/v8/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::setScriptSource):
+
 2012-12-24  Andrey Lushnikov  <[email protected]>
 
         Web Inspector: refactor TextEditorHighlighter's highlight attributes to dense array

Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (138441 => 138442)


--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2012-12-24 14:03:12 UTC (rev 138441)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2012-12-24 15:59:46 UTC (rev 138442)
@@ -313,6 +313,12 @@
 
 bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result)
 {
+    class EnableLiveEditScope {
+    public:
+        EnableLiveEditScope() { v8::Debug::SetLiveEditEnabled(true); }
+        ~EnableLiveEditScope() { v8::Debug::SetLiveEditEnabled(false); }
+    };
+
     ensureDebuggerScriptCompiled();
     v8::HandleScope scope;
 
@@ -322,16 +328,20 @@
 
     v8::Handle<v8::Value> argv[] = { deprecatedV8String(sourceID), deprecatedV8String(newContent), v8Boolean(preview) };
 
-    v8::TryCatch tryCatch;
-    tryCatch.SetVerbose(false);
-    v8::Local<v8::Value> v8result = callDebuggerMethod("liveEditScriptSource", 3, argv);
-    if (tryCatch.HasCaught()) {
-        v8::Local<v8::Message> message = tryCatch.Message();
-        if (!message.IsEmpty())
-            *error = toWebCoreStringWithUndefinedOrNullCheck(message->Get());
-        else
-            *error = "Unknown error.";
-        return false;
+    v8::Local<v8::Value> v8result;
+    {
+        EnableLiveEditScope enableLiveEditScope;
+        v8::TryCatch tryCatch;
+        tryCatch.SetVerbose(false);
+        v8result = callDebuggerMethod("liveEditScriptSource", 3, argv);
+        if (tryCatch.HasCaught()) {
+            v8::Local<v8::Message> message = tryCatch.Message();
+            if (!message.IsEmpty())
+                *error = toWebCoreStringWithUndefinedOrNullCheck(message->Get());
+            else
+                *error = "Unknown error.";
+            return false;
+        }
     }
     ASSERT(!v8result.IsEmpty());
     if (v8result->IsObject())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to