Changeset 241597 in webkit


Ignore:
Timestamp:
Feb 15, 2019 11:01:52 AM (5 years ago)
Author:
BJ Burg
Message:

[Mac] WebInspectorUI.framework does not need to be soft-linked anymore
https://bugs.webkit.org/show_bug.cgi?id=194411
<rdar://problem/47787614>

Reviewed by Joseph Pecoraro.

Source/WebKit:

  • Configurations/WebKit.xcconfig:

Conditionalize weak linking to WebInspectorUI.framework for Mac only.

  • UIProcess/mac/WebInspectorProxyMac.mm:

(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorTestPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL):

  • WebProcess/WebPage/mac/WebInspectorUIMac.mm:

(WebKit::webInspectorUILocalizedStringsURL):
Rewrite uses of the bundle to exit early if bundle couldn't be loaded.

Source/WebKitLegacy/mac:

  • Configurations/WebKitLegacy.xcconfig:

Conditionalize weak linking to WebInspectorUI.framework for Mac only.

  • WebCoreSupport/WebInspectorClient.mm:

(WebInspectorFrontendClient::localizedStringsURL):
(-[WebInspectorWindowController inspectorPagePath]):
(-[WebInspectorWindowController inspectorTestPagePath]):
Rewrite uses of the bundle to exit early if bundle couldn't be loaded.

Source/WTF:

  • wtf/cocoa/SoftLinking.h:

Remove macro that now has no uses.

Tools:

Remove unnecessary soft linking macro usage.

  • DumpRenderTree/mac/TestRunnerMac.mm:

(TestRunner::inspectorTestStubURL):
(SOFT_LINK_STAGED_FRAMEWORK): Deleted.

  • WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:

(WTR::TestRunner::inspectorTestStubURL):

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r241593 r241597  
     12019-02-15  Brian Burg  <bburg@apple.com>
     2
     3        [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=194411
     5        <rdar://problem/47787614>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * wtf/cocoa/SoftLinking.h:
     10        Remove macro that now has no uses.
     11
    1122019-02-15  Commit Queue  <commit-queue@webkit.org>
    213
  • trunk/Source/WTF/wtf/cocoa/SoftLinking.h

    r241586 r241597  
    8585    }
    8686
    87 #define SOFT_LINK_STAGED_FRAMEWORK(framework, unstagedLocation, version) \
    88     static void* framework##Library() \
    89     { \
    90         static void* frameworkLibrary = ^{ \
    91             void* result = dlopen("/System/Library/" #unstagedLocation "/" #framework ".framework/Versions/" #version "/" #framework, RTLD_LAZY); \
    92             if (!result) \
    93                 result = dlopen("/System/Library/StagedFrameworks/Safari/" #framework ".framework/Versions/" #version "/" #framework, RTLD_LAZY); \
    94             RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
    95             return result; \
    96         }(); \
    97         return frameworkLibrary; \
    98     }
    99 
    10087#define SOFT_LINK_FRAMEWORK_IN_UMBRELLA(umbrella, framework) \
    10188    static void* framework##Library() \
  • trunk/Source/WebKit/ChangeLog

    r241595 r241597  
     12019-02-15  Brian Burg  <bburg@apple.com>
     2
     3        [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=194411
     5        <rdar://problem/47787614>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * Configurations/WebKit.xcconfig:
     10        Conditionalize weak linking to WebInspectorUI.framework for Mac only.
     11
     12        * UIProcess/mac/WebInspectorProxyMac.mm:
     13        (WebKit::WebInspectorProxy::inspectorPageURL):
     14        (WebKit::WebInspectorProxy::inspectorTestPageURL):
     15        (WebKit::WebInspectorProxy::inspectorBaseURL):
     16        * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
     17        (WebKit::webInspectorUILocalizedStringsURL):
     18        Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
     19
    1202019-02-15  Alex Christensen  <achristensen@webkit.org>
    221
  • trunk/Source/WebKit/Configurations/WebKit.xcconfig

    r241586 r241597  
    128128WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
    129129
    130 FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
     130WK_WEBINSPECTORUI_LDFLAGS = $(WK_WEBINSPECTORUI_LDFLAGS_$(WK_PLATFORM_NAME));
     131WK_WEBINSPECTORUI_LDFLAGS_macosx = -weak_framework WebInspectorUI;
     132
     133FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
    131134
    132135// Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
  • trunk/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm

    r241586 r241597  
    11/*
    2  * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4343#import <WebCore/InspectorFrontendClientLocal.h>
    4444#import <WebCore/LocalizedStrings.h>
    45 #import <wtf/SoftLinking.h>
    4645#import <wtf/text/Base64.h>
    47 
    48 SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
    4946
    5047static const NSUInteger windowStyleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable | NSWindowStyleMaskFullSizeContentView;
     
    725722String WebInspectorProxy::inspectorPageURL()
    726723{
    727     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    728     WebInspectorUILibrary();
    729 
    730     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Main" ofType:@"html"];
    731     ASSERT([path length]);
    732 
    733     return [[NSURL fileURLWithPath:path isDirectory:NO] absoluteString];
    734 }
    735 
    736 String WebInspectorProxy::inspectorTestPageURL()
    737 {
    738     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    739     WebInspectorUILibrary();
    740 
    741     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Test" ofType:@"html"];
    742 
    743     // We might not have a Test.html in Production builds.
     724    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     725    if (!bundle)
     726        return String();
     727
     728    NSString *path = [bundle pathForResource:@"Main" ofType:@"html"];
     729    ASSERT(path && path.length);
    744730    if (!path)
    745731        return String();
    746732
    747     return [[NSURL fileURLWithPath:path isDirectory:NO] absoluteString];
     733    return [NSURL fileURLWithPath:path isDirectory:NO].absoluteString;
     734}
     735
     736String WebInspectorProxy::inspectorTestPageURL()
     737{
     738    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     739    if (!bundle)
     740        return String();
     741
     742    // We might not have a Test.html in Production builds.
     743    NSString *path = [bundle pathForResource:@"Test" ofType:@"html"];
     744    if (!path)
     745        return String();
     746
     747    return [NSURL fileURLWithPath:path isDirectory:NO].absoluteString;
    748748}
    749749
    750750String WebInspectorProxy::inspectorBaseURL()
    751751{
    752     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    753     WebInspectorUILibrary();
    754 
    755     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] resourcePath];
    756     ASSERT([path length]);
    757 
    758     return [[NSURL fileURLWithPath:path isDirectory:YES] absoluteString];
     752    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     753    if (!bundle)
     754        return String();
     755
     756    NSString *path = bundle.resourcePath;
     757    ASSERT(path && path.length);
     758
     759    return [NSURL fileURLWithPath:path isDirectory:YES].absoluteString;
    759760}
    760761
  • trunk/Source/WebKit/WebProcess/WebPage/mac/WebInspectorUIMac.mm

    r241586 r241597  
    11/*
    2  * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828#import "RemoteWebInspectorUI.h"
    2929
    30 #import <wtf/SoftLinking.h>
    31 
    32 SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
    33 
    3430namespace WebKit {
    3531
     
    4137static String webInspectorUILocalizedStringsURL()
    4238{
    43     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    44     WebInspectorUILibrary();
     39    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     40    if (!bundle)
     41        return String();
    4542
    46     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"localizedStrings" ofType:@"js"];
    47     if (path.length)
    48         return [[NSURL fileURLWithPath:path isDirectory:NO] absoluteString];
    49 
    50     return String();
     43    NSString *path = [bundle pathForResource:@"localizedStrings" ofType:@"js"];
     44    if (!path)
     45        return String();
     46   
     47    return [NSURL fileURLWithPath:path isDirectory:NO].absoluteString;
    5148}
    5249
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r241593 r241597  
     12019-02-15  Brian Burg  <bburg@apple.com>
     2
     3        [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=194411
     5        <rdar://problem/47787614>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * Configurations/WebKitLegacy.xcconfig:
     10        Conditionalize weak linking to WebInspectorUI.framework for Mac only.
     11
     12        * WebCoreSupport/WebInspectorClient.mm:
     13        (WebInspectorFrontendClient::localizedStringsURL):
     14        (-[WebInspectorWindowController inspectorPagePath]):
     15        (-[WebInspectorWindowController inspectorTestPagePath]):
     16        Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
     17
    1182019-02-15  Commit Queue  <commit-queue@webkit.org>
    219
  • trunk/Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig

    r241586 r241597  
    9393WK_SECURITY_INTERFACE_LDFLAGS_macosx = -framework SecurityInterface;
    9494
    95 OTHER_LDFLAGS = -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit $(WK_APPKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS);
     95WK_WEBINSPECTORUI_LDFLAGS = $(WK_WEBINSPECTORUI_LDFLAGS_$(WK_PLATFORM_NAME));
     96WK_WEBINSPECTORUI_LDFLAGS_macosx = -weak_framework WebInspectorUI;
     97
     98OTHER_LDFLAGS = -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit $(WK_APPKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
    9699
    97100SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(CONFIGURATION));
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm

    r241586 r241597  
    5454#import <WebKitLegacy/DOMExtensions.h>
    5555#import <algorithm>
    56 #import <wtf/SoftLinking.h>
    5756#import <wtf/text/Base64.h>
    58 
    59 SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
    6057
    6158using namespace WebCore;
     
    225222String WebInspectorFrontendClient::localizedStringsURL()
    226223{
    227     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    228     WebInspectorUILibrary();
    229 
    230     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"localizedStrings" ofType:@"js"];
    231     if ([path length])
    232         return [[NSURL fileURLWithPath:path] absoluteString];
    233     return String();
     224    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     225    if (!bundle)
     226        return String();
     227
     228    NSString *path = [bundle pathForResource:@"localizedStrings" ofType:@"js"];
     229    if (!path.length)
     230        return String();
     231   
     232    return [NSURL fileURLWithPath:path isDirectory:NO].absoluteString;
    234233}
    235234
     
    464463- (NSString *)inspectorPagePath
    465464{
    466     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    467     WebInspectorUILibrary();
    468 
    469     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Main" ofType:@"html"];
    470     ASSERT([path length]);
    471     return path;
     465    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     466    if (!bundle)
     467        return nil;
     468
     469    return [bundle pathForResource:@"Main" ofType:@"html"];
    472470}
    473471
    474472- (NSString *)inspectorTestPagePath
    475473{
    476     // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
    477     WebInspectorUILibrary();
    478 
    479     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Test" ofType:@"html"];
     474    NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"];
     475    if (!bundle)
     476        return nil;
    480477
    481478    // We might not have a Test.html in Production builds.
    482     if (!path)
    483         return nil;
    484 
    485     return path;
     479    return [bundle pathForResource:@"Test" ofType:@"html"];
    486480}
    487481
  • trunk/Tools/ChangeLog

    r241593 r241597  
     12019-02-15  Brian Burg  <bburg@apple.com>
     2
     3        [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=194411
     5        <rdar://problem/47787614>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        Remove unnecessary soft linking macro usage.
     10
     11        * DumpRenderTree/mac/TestRunnerMac.mm:
     12        (TestRunner::inspectorTestStubURL):
     13        (SOFT_LINK_STAGED_FRAMEWORK): Deleted.
     14        * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
     15        (WTR::TestRunner::inspectorTestStubURL):
     16
    1172019-02-15  Commit Queue  <commit-queue@webkit.org>
    218
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r241586 r241597  
    7878#import <wtf/WallTime.h>
    7979
    80 #if !PLATFORM(IOS_FAMILY)
    81 #import <wtf/SoftLinking.h>
    82 #endif
    83 
    8480#if PLATFORM(IOS_FAMILY)
    8581#import "UIKitSPI.h"
     
    9086
    9187#if !PLATFORM(IOS_FAMILY)
    92 SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
    9388
    9489@interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem>
     
    835830    return nullptr;
    836831#else
    837     // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work.
    838     WebInspectorUILibrary();
    839 
    840832    CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI"));
    841833    if (!inspectorBundle)
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm

    r241586 r241597  
    3030#import "InjectedBundle.h"
    3131#import <JavaScriptCore/JSStringRefCF.h>
    32 
    33 #if !PLATFORM(IOS_FAMILY)
    34 #import <wtf/SoftLinking.h>
    35 
    36 SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
    37 #endif
    3832
    3933namespace WTR {
     
    7771    return nullptr;
    7872#else
    79     // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work.
    80     WebInspectorUILibrary();
    81 
    8273    CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI"));
    8374    if (!inspectorBundle)
Note: See TracChangeset for help on using the changeset viewer.