Changeset 258877 in webkit


Ignore:
Timestamp:
Mar 23, 2020 2:50:48 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Allow distributors to brand user agent
https://bugs.webkit.org/show_bug.cgi?id=162611

Patch by Michael Catanzaro <Michael Catanzaro> on 2020-03-23
Reviewed by Adrian Perez de Castro.

.:

Add build option for inserting distributor branding into the user agent string.

  • Source/cmake/OptionsGTK.cmake:
  • Source/cmake/OptionsWPE.cmake:

Source/WebCore:

  • platform/glib/UserAgentGLib.cpp:

(WebCore::buildUserAgentString):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r258833 r258877  
     12020-03-23  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        [GTK] Allow distributors to brand user agent
     4        https://bugs.webkit.org/show_bug.cgi?id=162611
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Add build option for inserting distributor branding into the user agent string.
     9
     10        * Source/cmake/OptionsGTK.cmake:
     11        * Source/cmake/OptionsWPE.cmake:
     12
    1132020-03-23  Philippe Normand  <pnormand@igalia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r258875 r258877  
     12020-03-23  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        [GTK] Allow distributors to brand user agent
     4        https://bugs.webkit.org/show_bug.cgi?id=162611
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        * platform/glib/UserAgentGLib.cpp:
     9        (WebCore::buildUserAgentString):
     10
    1112020-03-23  Dean Jackson  <dino@apple.com>
    212
  • trunk/Source/WebCore/platform/glib/UserAgentGLib.cpp

    r257128 r258877  
    9090        uaString.append(platformForUAString());
    9191        uaString.appendLiteral("; ");
     92#if defined(USER_AGENT_BRANDING)
     93        uaString.appendLiteral(USER_AGENT_BRANDING "; ");
     94#endif
    9295        uaString.append(platformVersionForUAString());
    9396    }
     
    142145        userAgent = standardUserAgentStatic() + ' ' + applicationName + '/' + finalApplicationVersion;
    143146    }
    144     ASSERT(isValidUserAgentHeaderValue(userAgent));
     147
     148    static bool checked = false;
     149    if (!checked) {
     150        // For release builds, we'll only check the first resource load, mainly to ensure that any
     151        // configured application details or user agent branding is OK.
     152        RELEASE_ASSERT_WITH_MESSAGE(isValidUserAgentHeaderValue(userAgent), "%s is not a valid user agent header", userAgent.utf8().data());
     153        checked = true;
     154    }
     155    ASSERT(isValidUserAgentHeaderValue(userAgent);
    145156    return userAgent;
    146157}
  • trunk/Source/cmake/OptionsGTK.cmake

    r258833 r258877  
    1717set(INTROSPECTION_INSTALL_GIRDIR "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
    1818set(INTROSPECTION_INSTALL_TYPELIBDIR "${LIB_INSTALL_DIR}/girepository-1.0")
     19
     20set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string")
     21if (USER_AGENT_BRANDING)
     22    add_definitions(-DUSER_AGENT_BRANDING="${USER_AGENT_BRANDING}")
     23endif ()
    1924
    2025find_package(Cairo 1.14.0 REQUIRED)
  • trunk/Source/cmake/OptionsWPE.cmake

    r258833 r258877  
    1212set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
    1313set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/wpe-webkit-${WPE_API_VERSION}" CACHE PATH "Absolute path to install executables executed by the library")
     14
     15set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string")
     16if (USER_AGENT_BRANDING)
     17    add_definitions(-DUSER_AGENT_BRANDING=${USER_AGENT_BRANDING})
     18endif ()
    1419
    1520find_package(Cairo 1.14.0 REQUIRED)
Note: See TracChangeset for help on using the changeset viewer.