WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
48970
User scripts shouldn't be injected in a frame's empty initial document
https://bugs.webkit.org/show_bug.cgi?id=48970
Summary
User scripts shouldn't be injected in a frame's empty initial document
Brian Weinstein
Reported
2010-11-03 19:24:46 PDT
When a frame loads, it first creates an empty initial document, then navigates to the correct URL. In WebKit2, the timing is slightly different than WebKit1, so when a new window or tab is created, start scripts are injected into the frame when it is about:blank, and then when it navigates to the correct URL. This also happens when you inject scripts into all frames, iframes will look like they have had scripts injected twice - once with the URL being about:blank, and the other with the URL being the final URL of the frame. This is confusing to extension developers, and we shouldn't inject the scripts into the empty initial about:blank document. <
rdar://problem/8082122
> <
rdar://problem/8618164
>
Attachments
[PATCH] Fix
(10.87 KB, patch)
2010-11-03 19:59 PDT
,
Brian Weinstein
beidson
: review+
bweinstein
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Brian Weinstein
Comment 1
2010-11-03 19:59:36 PDT
Created
attachment 72900
[details]
[PATCH] Fix
Alexey Proskuryakov
Comment 2
2010-11-03 20:16:51 PDT
User scripts will still be injected into about:blank, correct?
Brian Weinstein
Comment 3
2010-11-03 21:17:59 PDT
(In reply to
comment #2
)
> User scripts will still be injected into about:blank, correct?
Yes - userscripts/script-run-at-start.html tests that scripts are injected into about:blank.
Brian Weinstein
Comment 4
2010-11-04 09:40:44 PDT
Landed in
r71339
.
Timothy Hatcher
Comment 5
2010-11-04 09:44:21 PDT
Comment on
attachment 72900
[details]
[PATCH] Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=72900&action=review
> WebCore/ChangeLog:10 > + When a frame loads, it first creates an empty initial document, then navigates to the correct URL. Our
So <iframe src="about:blank"> will still work and get the content scripts once?
> WebCore/ChangeLog:15 > + issue between WebKit1 and WebKit2 that causes start scripts to be injected into the initial empty document
Do we know what caused the timing issue between WK1 and WK2? Will that timing issue show up in other areas too?
Brian Weinstein
Comment 6
2010-11-04 09:50:37 PDT
(In reply to
comment #5
)
> (From update of
attachment 72900
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=72900&action=review
> > > WebCore/ChangeLog:10 > > + When a frame loads, it first creates an empty initial document, then navigates to the correct URL. Our > > So <iframe src="about:blank"> will still work and get the content scripts once?
Yes - it will get end scripts once, and start scripts once. We have a test for this in the WebKit tree. userscripts/script-run-at-start.html tests that start scripts are injected into about:blank.
> > > WebCore/ChangeLog:15 > > + issue between WebKit1 and WebKit2 that causes start scripts to be injected into the initial empty document > > Do we know what caused the timing issue between WK1 and WK2? Will that timing issue show up in other areas too?
I haven't seen it come up in other areas - we believe it was a timing issue with the IPC - either the app was sending the user scripts across the wire earlier, or the web process was starting and loading the page later, and by that point the user scripts list wasn't empty.
Andy Estes
Comment 7
2011-04-06 04:17:57 PDT
What about apps that create a frame and then add nodes to the initial document using DOM API? We should be able to inject scripts into these documents, no? I actually would like to use an injected script in this manner to fix <
https://bugs.webkit.org/show_bug.cgi?id=57794
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug