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/JavaScriptCore:
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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@197548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/RuntimeApplicationChecks.h b/Source/WebCore/platform/RuntimeApplicationChecks.h
index c38274e..5c7fed0 100644
--- a/Source/WebCore/platform/RuntimeApplicationChecks.h
+++ b/Source/WebCore/platform/RuntimeApplicationChecks.h
@@ -26,6 +26,8 @@
#ifndef RuntimeApplicationChecks_h
#define RuntimeApplicationChecks_h
+#include <wtf/Forward.h>
+
namespace WebCore {
WEBCORE_EXPORT bool applicationIsAOLInstantMessenger();
@@ -42,6 +44,9 @@
bool applicationIsSolidStateNetworksDownloader();
WEBCORE_EXPORT bool applicationIsVersions();
WEBCORE_EXPORT bool applicationIsHRBlock();
+WEBCORE_EXPORT bool applicationIsHipChat();
+
+WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
} // namespace WebCore