Commit ff72a0db authored by adele@apple.com's avatar adele@apple.com

Fix for <rdar://problem/9253454> Solar Walk For Mac: Info window is blank (HTML5 parser)

https://bugs.webkit.org/show_bug.cgi?id=60685

Reviewed by Darin Adler and Adam Barth.

Source/WebCore: 

Detect the Solar Walk application so we can add targeted parser quirks.

* WebCore.exp.in:
* platform/RuntimeApplicationChecks.cpp: (WebCore::applicationIsSolarWalk):
* platform/RuntimeApplicationChecks.h:

Source/WebKit: 

* WebKit.xcodeproj/project.pbxproj: Added Misc/SolarWalkQuirksUserScript.js and copy it to Resources during the build phase. 

Source/WebKit/mac: 

Solar Walk uses a self closing title tag, so to match the behavior of the old parser, 
we use a UserScript to write the contents of the title element to the end of the document so it can be re-parsed.

* Misc/SolarWalkQuirksUserScript.js: Added.
* WebView/WebView.mm:
(needsSolarWalkQuirksScript):
(leakSolarWalkQuirksUserScriptContents):
(-[WebView _injectSolarWalkQuirksScript]):
(-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a2f77992
2011-05-12 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler and Adam Barth.
Fix for <rdar://problem/9253454> Solar Walk For Mac: Info window is blank (HTML5 parser)
https://bugs.webkit.org/show_bug.cgi?id=60685
Detect the Solar Walk application so we can add targeted parser quirks.
* WebCore.exp.in:
* platform/RuntimeApplicationChecks.cpp: (WebCore::applicationIsSolarWalk):
* platform/RuntimeApplicationChecks.h:
2011-05-12 Jia Pu <jpu@apple.com>
Reviewed by Darin Adler.
......@@ -568,6 +568,7 @@ __ZN7WebCore21setGlobalIconDatabaseEPNS_16IconDatabaseBaseE
__ZN7WebCore21setPlatformStrategiesEPNS_18PlatformStrategiesE
__ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv
__ZN7WebCore22applicationIsAppleMailEv
__ZN7WebCore22applicationIsSolarWalkEv
__ZN7WebCore22contextMenuItemTagBoldEv
__ZN7WebCore22counterValueForElementEPNS_7ElementE
__ZN7WebCore22createFragmentFromTextEPNS_5RangeERKN3WTF6StringE
......
......@@ -102,4 +102,10 @@ bool applicationIsAperture()
return isAperture;
}
bool applicationIsSolarWalk()
{
static bool isSolarWalk = mainBundleIsEqualTo("com.vitotechnology.SolarWalkMac");
return isSolarWalk;
}
} // namespace WebCore
......@@ -36,6 +36,7 @@ bool applicationIsMicrosoftMessenger();
bool applicationIsMicrosoftMyDay();
bool applicationIsMicrosoftOutlook();
bool applicationIsSafari();
bool applicationIsSolarWalk();
} // namespace WebCore
......
2011-05-12 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler and Adam Barth.
Fix for <rdar://problem/9253454> Solar Walk For Mac: Info window is blank (HTML5 parser)
https://bugs.webkit.org/show_bug.cgi?id=60685
* WebKit.xcodeproj/project.pbxproj: Added Misc/SolarWalkQuirksUserScript.js and copy it to Resources during the build phase.
2011-04-18 Timothy Hatcher <timothy@apple.com>
Make update-webkit-localizable-strings put WebKit/win strings in WebCore
......
......@@ -343,6 +343,8 @@
A864B3F6123ED9FA00C2A612 /* MailQuirksUserScript.js in Resources */ = {isa = PBXBuildFile; fileRef = A864B3E5123ED83D00C2A612 /* MailQuirksUserScript.js */; };
AB9FBBBB0F8582B0006ADC43 /* WebDOMOperationsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = AB9FBBBA0F8582B0006ADC43 /* WebDOMOperationsInternal.h */; };
ABDDF20D08EB0DDC001E1241 /* WebDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */; };
B5974457137C7342002A18FF /* SolarWalkQuirksUserScript.js in Resources */ = {isa = PBXBuildFile; fileRef = B5DB1F17137C62F500A28E7E /* SolarWalkQuirksUserScript.js */; };
B5DB1F18137C62F500A28E7E /* SolarWalkQuirksUserScript.js in Sources */ = {isa = PBXBuildFile; fileRef = B5DB1F17137C62F500A28E7E /* SolarWalkQuirksUserScript.js */; };
B6CE5C24100BC5CE00219936 /* WebApplicationCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */; };
B6CE5C25100BC5F500219936 /* WebApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
B804176F1217A83100466BAE /* WebInspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = B804176D1217A83100466BAE /* WebInspectorFrontend.h */; };
......@@ -662,6 +664,7 @@
A864B3E5123ED83D00C2A612 /* MailQuirksUserScript.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = MailQuirksUserScript.js; sourceTree = "<group>"; };
AB9FBBBA0F8582B0006ADC43 /* WebDOMOperationsInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDOMOperationsInternal.h; sourceTree = "<group>"; };
ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDownloadInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
B5DB1F17137C62F500A28E7E /* SolarWalkQuirksUserScript.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = SolarWalkQuirksUserScript.js; sourceTree = "<group>"; };
B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCache.h; sourceTree = "<group>"; };
B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCache.mm; sourceTree = "<group>"; };
B804176D1217A83100466BAE /* WebInspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorFrontend.h; sourceTree = "<group>"; };
......@@ -948,6 +951,7 @@
isa = PBXGroup;
children = (
29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */,
B5DB1F17137C62F500A28E7E /* SolarWalkQuirksUserScript.js */,
A864B3E5123ED83D00C2A612 /* MailQuirksUserScript.js */,
1CCFFD120B1F81F2002EE926 /* OldWebAssertions.c */,
5DE92FEE0BD7017E0059A5FD /* WebAssertions.h */,
......@@ -1722,6 +1726,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B5974457137C7342002A18FF /* SolarWalkQuirksUserScript.js in Resources */,
29AEF960134C76FB00FE5096 /* OutlookQuirksUserScript.js in Resources */,
A864B3F6123ED9FA00C2A612 /* MailQuirksUserScript.js in Resources */,
939810BA0824BF01008DF038 /* IDNScriptWhiteList.txt in Resources */,
......@@ -2027,6 +2032,7 @@
BC42D34D131ED3880075FA4B /* WebLocalizableStringsInternal.mm in Sources */,
B82958D4132707D0000D0E79 /* CorrectionPanel.mm in Sources */,
A5687BDB135B791A0074CBCB /* WebNodeHighlighter.mm in Sources */,
B5DB1F18137C62F500A28E7E /* SolarWalkQuirksUserScript.js in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
2011-05-12 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler and Adam Barth.
Fix for <rdar://problem/9253454> Solar Walk For Mac: Info window is blank (HTML5 parser)
https://bugs.webkit.org/show_bug.cgi?id=60685
Solar Walk uses a self closing title tag, so to match the behavior of the old parser,
we use a UserScript to write the contents of the title element to the end of the document so it can be re-parsed.
* Misc/SolarWalkQuirksUserScript.js: Added.
* WebView/WebView.mm:
(needsSolarWalkQuirksScript):
(leakSolarWalkQuirksUserScriptContents):
(-[WebView _injectSolarWalkQuirksScript]):
(-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
2011-05-12 Jia Pu <jpu@apple.com>
Reviewed by Darin Adler.
......
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
(function() {
function reparseTitle()
{
// Solar Walk uses a self closing title tag, so to match the behavior of the old parser,
// we write the contents of the title element to the end of the document so it can be re-parsed.
document.write(document.title);
}
addEventListener("load", reparseTitle, false);
})();
......@@ -666,6 +666,27 @@ static NSString *leakOutlookQuirksUserScriptContents()
outlookQuirksScriptContents, KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInAllFrames);
}
static bool needsSolarWalkQuirksScript()
{
static bool isSolarWalkNeedingQuirksScript = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER)
&& applicationIsSolarWalk();
return isSolarWalkNeedingQuirksScript;
}
static NSString *leakSolarWalkQuirksUserScriptContents()
{
NSString *scriptPath = [[NSBundle bundleForClass:[WebView class]] pathForResource:@"SolarWalkQuirksUserScript" ofType:@"js"];
NSStringEncoding encoding;
return [[NSString alloc] initWithContentsOfFile:scriptPath usedEncoding:&encoding error:0];
}
-(void)_injectSolarWalkQuirksScript
{
static NSString *solarWalkQuirksScriptContents = leakSolarWalkQuirksUserScriptContents();
core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]),
solarWalkQuirksScriptContents, KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInAllFrames);
}
- (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews
{
WebCoreThreadViolationCheckRoundTwo();
......@@ -739,6 +760,11 @@ static NSString *leakOutlookQuirksUserScriptContents()
[self _injectOutlookQuirksScript];
}
if (needsSolarWalkQuirksScript()) {
_private->page->settings()->setShouldInjectUserScriptsInInitialEmptyDocument(true);
[self _injectSolarWalkQuirksScript];
}
[WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView];
NSRunLoop *runLoop = [NSRunLoop mainRunLoop];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment