[Webkit-unassigned] [Bug 40425] Web Inspector: provide API for content scripts to interact with the inspector

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 30 10:39:24 PDT 2010


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





--- Comment #25 from Andrey Kosyakov <caseq at chromium.org>  2010-07-30 10:39:24 PST ---
(In reply to comment #24)
> (From update of attachment 63061 [details])
> > Index: WebCore/inspector/InspectorController.cpp
> > ===================================================================
> > -    if (!enabled() || !m_frontend || frame != m_inspectedPage->mainFrame())
> > +    if (!enabled())
> > +        return;
> > +
> > +    if (m_scriptsToEvaluateOnLoad.size()) {
> > +        ScriptState* scriptState = mainWorldScriptState(frame);
> > +        for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
> > +             it != m_scriptsToEvaluateOnLoad.end(); ++it) {
> > +            m_injectedScriptHost->injectScript(*it, scriptState);
> > +        }
> > +    }
> > +
> > +    if (!m_frontend || frame != m_inspectedPage->mainFrame())
> >          return;
> >      m_injectedScriptHost->discardInjectedScripts();
> >  }
> 
> Minor point, which shouldn't prevent landing.
> This still doesn't look right to me. It looks like:
> 
>   1. if its disabled leave.
>   2. inject scripts.
>   3. if there is no frontend, leave.
>   4. discard injected scripts map.
> 
> It could be we just don't need the injected scripts any more,
> but if that is the case shouldn't we discard in the early return
> as well?

The discardInjectedScripts() logic does not change with this patch. We used to skip it if ether (a) inspector is not enabled, (b) frontend is not attached, or (c) the event comes for a subframe. I'm just inserting my code between (a) and (b). Actually, I think (a) is redundant both for injection of scriptsToEvaluateOnLoad and discardInjectedScripts(), as both are supposed to be a NOP in this case -- so we _could_ discard in early return as well (or remove the check altogether), but my idea was to leave the discardInjectedScripts() logic intact -- just in case.

-- 
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