c++ - IActiveScript profiling - view script source -
c++ - IActiveScript profiling - view script source -
i playing ie's javascript chakra engine.
i have downloaded illustration code msdn , trying figure out how function source when have function idand script id.
i start profiling js script , profiler (iactivescriptprofilercallback2) output can see functions compiled, called...
for illustration callback functioncompiled looks this. function id , script id, function name, can't figure out how find function source code.
hresult profiler::functioncompiled(profiler_token functionid, profiler_token scriptid, const wchar_t *pwszfunctionname, const wchar_t *pwszfunctionnamehint, iunknown *pidebugdocumentcontext) { fwprintf(stdout, l"profiler::functioncompiled: 0x%lx, 0x%lx, %s, %s\n", scriptid, functionid, pwszfunctionname, pwszfunctionnamehint); homecoming s_ok; }
i think solved it.. here ugly scriptcompiled function.
hresult profiler::scriptcompiled(profiler_token scriptid, profiler_script_type type, iunknown *pidebugdocumentcontext) { fwprintf(stdout, l"profiler::scriptcompiled: 0x%lx, %u\n", scriptid, type); if (pidebugdocumentcontext) { idebugdocumentcontext *debugdocumentcontext = null; pidebugdocumentcontext->queryinterface(__uuidof(idebugdocumentcontext), (void**)&debugdocumentcontext); idebugdocument *debugdocument = null; debugdocumentcontext->getdocument(&debugdocument); idebugdocumenttext *debugdocumenttext = null; debugdocument->queryinterface(__uuidof(idebugdocumenttext), (void**)&debugdocumenttext); ulong lines, chars; debugdocumenttext->getsize(&lines, &chars); printf("lines: %d chars: %d\n", lines, chars); chars++; wchar *text = (wchar*)malloc(sizeof(wchar) * chars); ulong charsretrieved = 0; debugdocumenttext->gettext(0, text, null, &charsretrieved, chars); text[charsretrieved] = l'\0'; wprintf(l"%s\n", text); } homecoming s_ok; } c++ internet-explorer com iactivescript
Comments
Post a Comment