WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
enable webkit to save javascript trace from inspector window
patch-16441.txt (text/plain), 5.52 KB, created by
Sajesh
on 2008-02-01 15:13:31 PST
(
hide
)
Description:
enable webkit to save javascript trace from inspector window
Filename:
MIME Type:
Creator:
Sajesh
Created:
2008-02-01 15:13:31 PST
Size:
5.52 KB
patch
obsolete
>Index: ChangeLog >=================================================================== >--- ChangeLog (revision 29927) >+++ ChangeLog (working copy) >@@ -1,3 +1,44 @@ >+2008-02-01 apple <set EMAIL_ADDRESS environment variable> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WARNING: NO TEST CASES ADDED OR CHANGED >+ >+ * page/InspectorController.cpp: >+ (WebCore::toggleJStrace): >+ (WebCore::InspectorController::toggleJSTrace): >+ * page/InspectorController.h: >+ * page/inspector/inspector.html: >+ * page/inspector/inspector.js: >+ > >Index: page/InspectorController.cpp >=================================================================== >--- page/InspectorController.cpp (revision 29878) >+++ page/InspectorController.cpp (working copy) >@@ -60,6 +60,8 @@ > #include <JavaScriptCore/JSRetainPtr.h> > #include <JavaScriptCore/JSStringRef.h> > #include <wtf/RefCounted.h> >+#include <JavaScriptCore/JSStringRefCF.h> >+#import <ApplicationServices/ApplicationServices.h> > >+ >+static JSValueRef toggleJStrace(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/) >+{ >+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject)); >+ if (!controller) >+ return JSValueMakeUndefined(ctx); >+ >+ if (argumentCount < 1 || !JSValueIsBoolean(ctx, arguments[0])) >+ return JSValueMakeUndefined(ctx); >+ >+ bool toggle = JSValueToBoolean( ctx, arguments[0] ); >+ controller->toggleJSTrace(toggle); >+ >+ return JSValueMakeUndefined(ctx); >+} >+ > >@@ -755,6 +887,7 @@ void InspectorController::windowScriptOb > { "windowUnloading", unloading, kJSPropertyAttributeNone }, > { "attach", attach, kJSPropertyAttributeNone }, > { "detach", detach, kJSPropertyAttributeNone }, > { "search", search, kJSPropertyAttributeNone }, > #if ENABLE(DATABASE) > { "databaseTableNames", databaseTableNames, kJSPropertyAttributeNone }, >@@ -763,6 +896,10 @@ void InspectorController::windowScriptOb > { "localizedStringsURL", localizedStrings, kJSPropertyAttributeNone }, > { "platform", platform, kJSPropertyAttributeNone }, > { "moveByUnrestricted", moveByUnrestricted, kJSPropertyAttributeNone }, >+ { "toggleJStrace", toggleJStrace, kJSPropertyAttributeNone }, > { 0, 0, 0 } > }; > >@@ -1572,4 +1709,282 @@ void InspectorController::moveWindowBy(f > m_page->chrome()->setWindowRect(frameRect); > } > >+ >+CFStringRef InspectorController::getCurrentUserHomeDir() >+{ >+ OSErr err; >+ FSRef prefFolderRef; >+ CFURLRef prefURL = NULL; >+ >+ err = FSFindFolder(kUserDomain, kCurrentUserFolderType, kDontCreateFolder, &prefFolderRef); >+ >+ if (err == noErr) >+ prefURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &prefFolderRef); >+ >+ CFStringRef fsPath = CFURLCopyFileSystemPath (prefURL, kCFURLPOSIXPathStyle); >+ >+ return fsPath; >+} >+ >+void InspectorController::toggleJSTrace(bool toggle) >+{ >+ //to enable and disable trace >+ CFStringRef homeDir = getCurrentUserHomeDir(); >+ CFMutableStringRef logFile = CFStringCreateMutable (kCFAllocatorDefault, 0); >+ >+ CFStringAppend(logFile, homeDir); >+ CFStringAppend(logFile, CFSTR("/Library/Logs/webkit-javascript-stack-trace.log")); >+ const char *logDir = CFStringGetCStringPtr(logFile, NULL); >+ setenv("JSHOME", logDir, 1); >+ >+ if ( toggle ) >+ setenv("JSTRACE", "YES", 1); >+ else >+ setenv("JSTRACE", "NO", 1); >+} >+ >+ > } // namespace WebCore >Index: page/InspectorController.h >=================================================================== >--- page/InspectorController.h (revision 29878) >+++ page/InspectorController.h (working copy) >@@ -115,6 +115,21 @@ public: > void didOpenDatabase(Database*, const String& domain, const String& name, const String& version); > #endif > >+ //Bug 16440: ER: file replacement support & Bug 16441: ER: support for saving js stack trace to file >+ void toggleJSTrace(bool toggle); >+ CFStringRef getCurrentUserHomeDir(); >+ > const ResourcesMap& resources() const { return m_resources; } > > void moveWindowBy(float x, float y) const; >Index: page/inspector/inspector.html >=================================================================== >--- page/inspector/inspector.html (revision 29878) >+++ page/inspector/inspector.html (working copy) >@@ -54,6 +54,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE PO > <body class="detached"> > <div id="toolbar"> > <button id="back" class="split-button first"><img></button><img class="split-button-divider"><button id="forward" class="split-button last"><img></button> >+ <input type='checkbox' value='Save JS' id='chkBox' title='Save JS trace' onclick="WebInspector.toggleJStrace()"></input> >+ <label for='chkBox'>Save JS trace</label> > <span id="toolbarButtons"></span> > <input id="search" type="search" autosave="inspectorSearch" results="20" incremental="incremental" onsearch="WebInspector.performSearch(this.value)"> > </div> >Index: page/inspector/inspector.js >=================================================================== >--- page/inspector/inspector.js (revision 29878) >+++ page/inspector/inspector.js (working copy) >@@ -1184,3 +1184,59 @@ WebInspector.MIMETypes = { > "text/jscript": {4: true}, > "text/livescript": {4: true}, > } > >+WebInspector.toggleJStrace = function() >+{ >+ if ( event.target.checked ) >+ { >+ InspectorController.toggleJStrace( true ) ; >+ } >+ else >+ { >+ InspectorController.toggleJStrace( false ) ; >+ } >+} >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
aroben
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 16441
: 18857 |
18863