Bug 28866
Summary: | when you add a new css rule via the web inspector, reload the page, and try again it will not work | ||
---|---|---|---|
Product: | WebKit | Reporter: | ryankshaw+webkitbugzilla |
Component: | Web Inspector (Deprecated) | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WORKSFORME | ||
Severity: | Normal | CC: | joepeck, me, timothy |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All |
ryankshaw+webkitbugzilla
in the CSS part of the web inspector, when you click the "Double-Click to add" and add a new style (say: "body p") and set color:red then reload the page and do the exact same thing, it does not work.
In comment https://bugs.webkit.org/show_bug.cgi?id=27124#c13 Timothy Hatcher says this:
I think what is happeneing here is that we have a reference to the style
element we created for the previous page still, so we think we don't need to
make a new one and just append to the old one in the previous page.
This reference should be cleared in the ElementsPanel reset method.
for more info see:
comment 12 and 13 of
https://bugs.webkit.org/show_bug.cgi?id=27124
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Joseph Pecoraro
We do still have a reference to the style element, which needs to be cleared:
delete InjectedScript.stylesheet;
However, there is no safe place to clear this. The ElementPanel's constructor does not appear to get rerun on a refresh, only reset(). However, reset() gets called all over the place and making new stylesheets would lose access to deleting old rules. I have a similar problem with Cookies in the StoragePanel which I alluded to in Bug 27202.
I propose adding a hook for panels names something like "onpageload" or "onrefresh". The idea being (correct me if I am wrong):
- A Panel's Constructor is run once when the Inspector is first opened
- populateInterface() is run when ...?
- reset() is called all over the place without knowledge of new pages
- onpageload() would be called on navigation (including page refresh)
onpageload() plugs the hole of wanting to do something once per page load such as:
- Wiping (or Creating) the Injected Stylesheet
- Adding the Cookies Tree Element once, because it need only be made once
Uglier, but still usable would be providing a flag to reset like reset(isPageLoad) which could be made true on new page loads.
Timothy Hatcher
I guess reset does serve to purposes. It is called when the page loads and when the Inspector is closed. Spliting this into two functions would be fine, but I think the flag on reset is good too.
Nikita Vasilyev
Looks like the bug has been fixed by https://bugs.webkit.org/show_bug.cgi?id=27124 (or something else). I can't reproduce it.