- Revision
- 197548
- Author
- [email protected]
- Date
- 2016-03-03 22:00:02 -0800 (Thu, 03 Mar 2016)
Log Message
Regression(r196770): Unable to use HipChat Mac app
https://bugs.webkit.org/show_bug.cgi?id=154999
<rdar://problem/24931959>
Reviewed by Darin Adler.
Source/_javascript_Core:
Add a setter to PutPropertySlot to override the 'isStrictMode' flag.
* runtime/PutPropertySlot.h:
(JSC::PutPropertySlot::setStrictMode):
Source/WebCore:
r196770 made [Unforgeable] operations such as Location.reload()
non-writable as per the Web IDL specification. As a result,
trying to set such properties will be ignored in non-strict
mode and will throw an exception is strict mode. This also matches
Firefox and Chrome.
However, this broke the HipChat Mac App (the Web App seems fine)
because it sets Location.reload() and is using strict mode, therefore
causing an exception to be thrown.
This patch adds a quirk to JSLocation::putDelegate() which disable
strict mode when we detect that the application is HipChat. As a
result, we no longer throw when HipChat tries to set Location.reload
and the application is able to connect again.
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::putDelegate):
Add a quirk which disables strict mode if the application is HipChat.
* platform/RuntimeApplicationChecks.cpp:
(WebCore::mainBundleIdentifier):
Extract this from mainBundleIsEqualTo() so it can be shared with
applicationBundleIdentifier().
(WebCore::applicationBundleIdentifier):
Returns the application bundle identifier, which is a static variable.
For the WebContent / Networking processes, the application bundle
identifier gets set to the UIProcess bundle identifier upon
initialization. If unset, we fall back to using mainBundleIdentifier()
which will do the right thing for the WK2 UIProcess and WK1.
(WebCore::mainBundleIsEqualTo):
Extract part of the code to mainBundleIdentifier() to better share
code.
(WebCore::applicationIsHipChat):
Add utility function that checks if the application is HipChat. This
will do the right thing whether it is called from the UIProcess, the
WebProcess or the UIProcess.
(WebCore::setApplicationBundleIdentifier):
Add utility function to set the application bundle identifier. It gets
called with the UIProcess bundle identifier by the NetworkProcess and
the WebProcess upon initialization.
* platform/RuntimeApplicationChecks.h:
Source/WebKit2:
Have the NetworkProcess and the WebProcess pass the UIProcess bundle
identifier to WebCore so that we can do app detection of applications
using a WK2 WebView (such as HipChat).
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (197547 => 197548)
--- trunk/Source/_javascript_Core/ChangeLog 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-03-04 06:00:02 UTC (rev 197548)
@@ -1,3 +1,16 @@
+2016-03-03 Chris Dumez <[email protected]>
+
+ Regression(r196770): Unable to use HipChat Mac app
+ https://bugs.webkit.org/show_bug.cgi?id=154999
+ <rdar://problem/24931959>
+
+ Reviewed by Darin Adler.
+
+ Add a setter to PutPropertySlot to override the 'isStrictMode' flag.
+
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setStrictMode):
+
2016-03-03 Benjamin Poulain <[email protected]>
[JSC] Add support for MADD, MSUB and MNEG to Air
Modified: trunk/Source/_javascript_Core/runtime/PutPropertySlot.h (197547 => 197548)
--- trunk/Source/_javascript_Core/runtime/PutPropertySlot.h 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/_javascript_Core/runtime/PutPropertySlot.h 2016-03-04 06:00:02 UTC (rev 197548)
@@ -94,6 +94,11 @@
m_thisValue = thisValue;
}
+ void setStrictMode(bool value)
+ {
+ m_isStrictMode = value;
+ }
+
PutValueFunc customSetter() const
{
ASSERT(isCacheableCustom());
Modified: trunk/Source/WebCore/ChangeLog (197547 => 197548)
--- trunk/Source/WebCore/ChangeLog 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebCore/ChangeLog 2016-03-04 06:00:02 UTC (rev 197548)
@@ -1,3 +1,58 @@
+2016-03-03 Chris Dumez <[email protected]>
+
+ Regression(r196770): Unable to use HipChat Mac app
+ https://bugs.webkit.org/show_bug.cgi?id=154999
+ <rdar://problem/24931959>
+
+ Reviewed by Darin Adler.
+
+ r196770 made [Unforgeable] operations such as Location.reload()
+ non-writable as per the Web IDL specification. As a result,
+ trying to set such properties will be ignored in non-strict
+ mode and will throw an exception is strict mode. This also matches
+ Firefox and Chrome.
+
+ However, this broke the HipChat Mac App (the Web App seems fine)
+ because it sets Location.reload() and is using strict mode, therefore
+ causing an exception to be thrown.
+
+ This patch adds a quirk to JSLocation::putDelegate() which disable
+ strict mode when we detect that the application is HipChat. As a
+ result, we no longer throw when HipChat tries to set Location.reload
+ and the application is able to connect again.
+
+ * bindings/js/JSLocationCustom.cpp:
+ (WebCore::JSLocation::putDelegate):
+ Add a quirk which disables strict mode if the application is HipChat.
+
+ * platform/RuntimeApplicationChecks.cpp:
+ (WebCore::mainBundleIdentifier):
+ Extract this from mainBundleIsEqualTo() so it can be shared with
+ applicationBundleIdentifier().
+
+ (WebCore::applicationBundleIdentifier):
+ Returns the application bundle identifier, which is a static variable.
+ For the WebContent / Networking processes, the application bundle
+ identifier gets set to the UIProcess bundle identifier upon
+ initialization. If unset, we fall back to using mainBundleIdentifier()
+ which will do the right thing for the WK2 UIProcess and WK1.
+
+ (WebCore::mainBundleIsEqualTo):
+ Extract part of the code to mainBundleIdentifier() to better share
+ code.
+
+ (WebCore::applicationIsHipChat):
+ Add utility function that checks if the application is HipChat. This
+ will do the right thing whether it is called from the UIProcess, the
+ WebProcess or the UIProcess.
+
+ (WebCore::setApplicationBundleIdentifier):
+ Add utility function to set the application bundle identifier. It gets
+ called with the UIProcess bundle identifier by the NetworkProcess and
+ the WebProcess upon initialization.
+
+ * platform/RuntimeApplicationChecks.h:
+
2016-03-03 Keith Miller <[email protected]>
JSArrayBuffers should be collected less aggressively
Modified: trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp (197547 => 197548)
--- trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp 2016-03-04 06:00:02 UTC (rev 197548)
@@ -24,6 +24,7 @@
#include "JSLocation.h"
#include "JSDOMBinding.h"
+#include "RuntimeApplicationChecks.h"
#include <runtime/JSFunction.h>
using namespace JSC;
@@ -84,6 +85,12 @@
if (propertyName != exec->propertyNames().href && !sameDomainAccess)
return true;
+#if PLATFORM(MAC)
+ // FIXME: HipChat tries to set Location.reload which causes an exception to be thrown in strict mode (see <rdar://problem/24931959>).
+ if (applicationIsHipChat())
+ slot.setStrictMode(false);
+#endif
+
return false;
}
Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.cpp (197547 => 197548)
--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.cpp 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.cpp 2016-03-04 06:00:02 UTC (rev 197548)
@@ -26,25 +26,54 @@
#include "config.h"
#include "RuntimeApplicationChecks.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/RunLoop.h>
+#include <wtf/text/WTFString.h>
+
#if USE(CF)
#include <CoreFoundation/CoreFoundation.h>
#include <wtf/RetainPtr.h>
#endif
-#include <wtf/text/WTFString.h>
+namespace WebCore {
-namespace WebCore {
-
+#if USE(CF)
+static CFStringRef mainBundleIdentifier()
+{
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+ if (!mainBundle)
+ return nullptr;
+
+ return CFBundleGetIdentifier(mainBundle);
+}
+#endif
+
+// The application bundle identifier gets set to the UIProcess bundle identifier by the WebProcess and
+// the networking process upon initialization.
+// If not explicitly set, this will return the main bundle identifier which is accurate for WK1 or
+// the WK2 UIProcess.
+static String& applicationBundleIdentifier()
+{
+ ASSERT(RunLoop::isMain());
+
+#if USE(CF)
+ static NeverDestroyed<String> identifier(mainBundleIdentifier());
+#else
+ static NeverDestroyed<String> identifier;
+#endif
+
+ return identifier;
+}
+
+// FIXME: This should probably be renamed to applicationBundleIsEqualTo() and use applicationBundleIdentifier()
+// instead of mainBundleIdentifier() internally. This would have the benefit of working for both WebKit1 and
+// WebKit2.
static bool mainBundleIsEqualTo(const String& bundleIdentifierString)
{
// FIXME: We should consider merging this file with RuntimeApplicationChecksIOS.mm.
// Then we can remove the PLATFORM(IOS)-guard.
#if USE(CF) && !PLATFORM(IOS)
- CFBundleRef mainBundle = CFBundleGetMainBundle();
- if (!mainBundle)
- return false;
-
- CFStringRef bundleIdentifier = CFBundleGetIdentifier(mainBundle);
+ CFStringRef bundleIdentifier = mainBundleIdentifier();
if (!bundleIdentifier)
return false;
@@ -139,4 +168,16 @@
return isSolidStateNetworksDownloader;
}
+bool applicationIsHipChat()
+{
+ static bool isHipChat = applicationBundleIdentifier() == "com.hipchat.HipChat";
+ ASSERT_WITH_MESSAGE(isHipChat == (applicationBundleIdentifier() == "com.hipchat.HipChat"), "Should not be called before setApplicationBundleIdentifier()");
+ return isHipChat;
+}
+
+void setApplicationBundleIdentifier(const String& bundleIdentifier)
+{
+ applicationBundleIdentifier() = bundleIdentifier;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (197547 => 197548)
--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h 2016-03-04 06:00:02 UTC (rev 197548)
@@ -26,6 +26,8 @@
#ifndef RuntimeApplicationChecks_h
#define RuntimeApplicationChecks_h
+#include <wtf/Forward.h>
+
namespace WebCore {
WEBCORE_EXPORT bool applicationIsAOLInstantMessenger();
@@ -42,7 +44,10 @@
bool applicationIsSolidStateNetworksDownloader();
WEBCORE_EXPORT bool applicationIsVersions();
WEBCORE_EXPORT bool applicationIsHRBlock();
+WEBCORE_EXPORT bool applicationIsHipChat();
+WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
+
} // namespace WebCore
#endif // RuntimeApplicationChecks_h
Modified: trunk/Source/WebKit2/ChangeLog (197547 => 197548)
--- trunk/Source/WebKit2/ChangeLog 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-04 06:00:02 UTC (rev 197548)
@@ -1,3 +1,20 @@
+2016-03-03 Chris Dumez <[email protected]>
+
+ Regression(r196770): Unable to use HipChat Mac app
+ https://bugs.webkit.org/show_bug.cgi?id=154999
+ <rdar://problem/24931959>
+
+ Reviewed by Darin Adler.
+
+ Have the NetworkProcess and the WebProcess pass the UIProcess bundle
+ identifier to WebCore so that we can do app detection of applications
+ using a WK2 WebView (such as HipChat).
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::initializeNetworkProcess):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeWebProcess):
+
2016-03-03 Simon Fraser <[email protected]>
Use larger tiles when possible to reduce per-tile painting overhead
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (197547 => 197548)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-03-04 06:00:02 UTC (rev 197548)
@@ -53,6 +53,7 @@
#include <WebCore/Logging.h>
#include <WebCore/PlatformCookieJar.h>
#include <WebCore/ResourceRequest.h>
+#include <WebCore/RuntimeApplicationChecks.h>
#include <WebCore/SecurityOriginData.h>
#include <WebCore/SecurityOriginHash.h>
#include <WebCore/SessionID.h>
@@ -214,6 +215,7 @@
setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation);
#if PLATFORM(COCOA) || USE(CFNETWORK)
+ setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (197547 => 197548)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-03-04 05:49:23 UTC (rev 197547)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-03-04 06:00:02 UTC (rev 197548)
@@ -86,6 +86,7 @@
#include <WebCore/PageGroup.h>
#include <WebCore/PlatformMediaSessionManager.h>
#include <WebCore/ResourceHandle.h>
+#include <WebCore/RuntimeApplicationChecks.h>
#include <WebCore/RuntimeEnabledFeatures.h>
#include <WebCore/SchemeRegistry.h>
#include <WebCore/SecurityOrigin.h>
@@ -327,6 +328,7 @@
setShouldUseFontSmoothing(true);
#if PLATFORM(COCOA) || USE(CFNETWORK)
+ setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
#endif