Bug 87540

Summary: Allow synchronous XHRs to be disabled in documents
Product: WebKit Reporter: Mihai Parparita <mihaip>
Component: Page LoadingAssignee: Mihai Parparita <mihaip>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dglazkov, eric, fishd, jamesr, levin, tkent+wkapi, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 87783    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Mihai Parparita 2012-05-25 15:38:25 PDT
Allow synchronous XHRs to be disabled in documents
Comment 1 Mihai Parparita 2012-05-25 16:19:50 PDT
Created attachment 144166 [details]
Patch
Comment 2 WebKit Review Bot 2012-05-25 16:23:01 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Eric Seidel (no email) 2012-05-25 16:30:22 PDT
Are we disabling them in extensions or something?  I support this change, but I'm curious why we'd have it.
Comment 4 Mihai Parparita 2012-05-25 16:33:44 PDT
(In reply to comment #3)
> Are we disabling them in extensions or something?  I support this change, but I'm curious why we'd have it.

Yeah, for apps. See https://chromiumcodereview.appspot.com/10443047 for the Chromium side that uses this.
Comment 5 Eric Seidel (no email) 2012-05-25 16:37:19 PDT
Comment on attachment 144166 [details]
Patch

LGTM.
Comment 6 Alexey Proskuryakov 2012-05-25 18:08:32 PDT
Comment on attachment 144166 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=144166&action=review

> Source/WebCore/xml/XMLHttpRequest.cpp:489
> +            logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests cannot be made in the current window context.");

Is there a way to explain the reason to authors seeing this? The current wording is a bit misleading (cannot be made in current context, so it can be made in another? what do I do to enable them again?)
Comment 7 Adam Barth 2012-05-25 18:14:48 PDT
Maybe "Synchronous XMLHttpRequests are disabled for this page" ?
Comment 8 WebKit Review Bot 2012-05-25 19:06:06 PDT
Comment on attachment 144166 [details]
Patch

Clearing flags on attachment: 144166

Committed r118599: <http://trac.webkit.org/changeset/118599>
Comment 9 WebKit Review Bot 2012-05-25 19:06:19 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Alexey Proskuryakov 2012-05-29 14:48:12 PDT
This made a lot of tests "flaky" on bots, because the setting leaks from the added test to all future ones:

--- /Volumes/Data/slave/lion-intel-release-tests-wk2/build/layout-test-results/fast/xpath/4XPath/Borrowed/od_20000608-expected.txt
+++ /Volumes/Data/slave/lion-intel-release-tests-wk2/build/layout-test-results/fast/xpath/4XPath/Borrowed/od_20000608-actual.txt
@@ -1,6 +1,6 @@
-PASS nodeset.snapshotLength is 0
-PASS nodeset.snapshotLength is 12
-PASS successfullyParsed is true
+CONSOLE MESSAGE: Synchronous XMLHttpRequests cannot be made in the current window context.
+CONSOLE MESSAGE: line 67: INVALID_ACCESS_ERR: DOM Exception 15: A parameter or an operation was not supported by the underlying object.
+FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
 
 TEST COMPLETE
Comment 11 Alexey Proskuryakov 2012-05-29 14:50:48 PDT
Filed bug 87783 about that.