From a8243fb21c840dd27560481095fd398b31ef7987 Mon Sep 17 00:00:00 2001 From: "aperez@igalia.com" Date: Tue, 11 Sep 2018 19:26:47 +0000 Subject: [PATCH] [WPE][GTK] API documentation is unclear about how to modify requests before sending them https://bugs.webkit.org/show_bug.cgi?id=189505 Reviewed by Michael Catanzaro. Add notes to the API documentation to make explicit where modification of WebKitURIRequest instances affects the request data sent over the network. * UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that modifications to the associated WebKitURIRequest do not affect the actual request. Point to WebKitPage::send-request instead. * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto. * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_class_init): Ditto for the description of the WebKitWebView::decide-policy signal. Also fix the syntax of example. * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (webkit_web_page_class_init): Indicate that modifications to the WebKitURIRequest will change the actual network request data. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235909 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/ChangeLog | 22 ++++++++++++++++++++++ .../UIProcess/API/glib/WebKitNavigationAction.cpp | 7 ++++++- .../API/glib/WebKitResponsePolicyDecision.cpp | 7 ++++++- Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp | 6 ++++-- .../InjectedBundle/API/glib/WebKitWebPage.cpp | 4 ++++ 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 821d28e..04cbb93 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,25 @@ +2018-09-11 Adrian Perez de Castro + + [WPE][GTK] API documentation is unclear about how to modify requests before sending them + https://bugs.webkit.org/show_bug.cgi?id=189505 + + Reviewed by Michael Catanzaro. + + Add notes to the API documentation to make explicit where modification + of WebKitURIRequest instances affects the request data sent over the + network. + + * UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that + modifications to the associated WebKitURIRequest do not affect the + actual request. Point to WebKitPage::send-request instead. + * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto. + * UIProcess/API/glib/WebKitWebView.cpp: + (webkit_web_view_class_init): Ditto for the description of the + WebKitWebView::decide-policy signal. Also fix the syntax of example. + * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: + (webkit_web_page_class_init): Indicate that modifications to the + WebKitURIRequest will change the actual network request data. + 2018-09-11 Michael Catanzaro Unreviewed, attempt to fix Apple builds after r235903 diff --git a/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp b/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp index a8db939..c9d9ada 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp @@ -124,7 +124,12 @@ unsigned webkit_navigation_action_get_modifiers(WebKitNavigationAction* navigati * webkit_navigation_action_get_request: * @navigation: a #WebKitNavigationAction * - * Return the navigation #WebKitURIRequest + * Return the #WebKitURIRequest associated with the navigation action. + * Modifications to the returned object are not taken + * into account when the request is sent over the network, and is intended + * only to aid in evaluating whether a navigation action should be taken or + * not. To modify requests before they are sent over the network the + * #WebKitPage::send-request signal can be used instead. * * Returns: (transfer none): a #WebKitURIRequest * diff --git a/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp b/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp index ee869d0..bf4001b 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp @@ -114,7 +114,12 @@ static void webkit_response_policy_decision_class_init(WebKitResponsePolicyDecis * webkit_response_policy_decision_get_request: * @decision: a #WebKitResponsePolicyDecision * - * Gets the value of the #WebKitResponsePolicyDecision:request property. + * Return the #WebKitURIRequest associated with the response decision. + * Modifications to the returned object are not taken + * into account when the request is sent over the network, and is intended + * only to aid in evaluating whether a response decision should be taken or + * not. To modify requests before they are sent over the network the + * #WebKitPage::send-request signal can be used instead. * * Returns: (transfer none): The URI request that is associated with this policy decision. */ diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp index e687311..5ac46cc 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp @@ -1387,14 +1387,16 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * WebKitPolicyDecisionType type) * { * switch (type) { - * case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: + * case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: { * WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); * /* Make a policy decision here. */ * break; - * case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: + * } + * case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: { * WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); * /* Make a policy decision here. */ * break; + * } * case WEBKIT_POLICY_DECISION_TYPE_RESPONSE: * WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision); * /* Make a policy decision here. */ diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp b/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp index 667cd81..47f0f04 100644 --- a/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp +++ b/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp @@ -479,6 +479,10 @@ static void webkit_web_page_class_init(WebKitWebPageClass* klass) * @redirected_response parameter containing the response * received by the server for the initial request. * + * Modifications to the #WebKitURIRequest and its associated + * #SoupMessageHeaders will be taken into account when the request + * is sent over the network. + * * Returns: %TRUE to stop other handlers from being invoked for the event. * %FALSE to continue emission of the event. */ -- 1.8.3.1