[Webkit-unassigned] [Bug 126038] Web Inspector: Extract CommandLineAPI into its own InjectedScriptModule

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 19 19:05:04 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=126038





--- Comment #3 from Joseph Pecoraro <joepeck at webkit.org>  2013-12-19 19:03:07 PST ---
(From update of attachment 219713)
View in context: https://bugs.webkit.org/attachment.cgi?id=219713&action=review

> Source/WebCore/inspector/PageRuntimeAgent.cpp:143
>          JSC::ExecState* scriptState = mainWorldExecState(&m_inspectedPage->mainFrame());
>          InjectedScript result = injectedScriptManager()->injectedScriptFor(scriptState);
>          if (result.hasNoValue())
> -            *errorString = "Internal error: main world execution context not found.";
> +            *errorString = ASCIILiteral("Internal error: main world execution context not found.");
> +        CommandLineAPIModule::injectIfNeeded(injectedScriptManager(), result);
>          return result;
>      }
> +
>      InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId(*executionContextId);
>      if (injectedScript.hasNoValue())
> -        *errorString = "Execution context with given id not found.";
> +        *errorString = ASCIILiteral("Execution context with given id not found.");
> +    CommandLineAPIModule::injectIfNeeded(injectedScriptManager(), injectedScript);
>      return injectedScript;
>  }

Although this works, I don't think it is ideal. This means every time you evaluate something in the console (e.g. 1+1) we first evaluate and check the result of 'InjectedScript.module("CommandLineAPI")'.

I think a better approach will be to subclass InjectedScriptManager, and provide a one evaluate at the same time we create InjectedScript. So we only have to inject the CommandLineAPI once, instead of keep checking it. I'll make this change tomorrow.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list