Changeset 108450 in webkit
- Timestamp:
- Feb 21, 2012 11:28:04 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r108444 r108450 1031 1031 page/Navigator.cpp 1032 1032 page/NavigatorBase.cpp 1033 page/NavigatorRegisterProtocolHandler.cpp 1033 1034 page/NavigatorSupplement.cpp 1034 1035 page/OriginAccessEntry.cpp -
trunk/Source/WebCore/ChangeLog
r108449 r108450 1 2012-02-21 Adam Barth <abarth@webkit.org> 2 3 Separate the implementation of registerProtocolHandler from Navigator.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=78945 5 6 Reviewed by Eric Seidel. 7 8 The implementation of registerProtocolHandler needlessly complicates 9 the implementation of Navigator.cpp. In principle, 10 registerProtocolHandler (and possibly registerContentHandler, when we 11 implement that feature) could be its own module, but that seems like 12 overkill for one or two files. 13 14 * CMakeLists.txt: 15 * GNUmakefile.list.am: 16 * Target.pri: 17 * WebCore.gypi: 18 * WebCore.vcproj/WebCore.vcproj: 19 * WebCore.xcodeproj/project.pbxproj: 20 * page/Navigator.cpp: 21 (WebCore): 22 * page/Navigator.h: 23 (Navigator): 24 * page/Navigator.idl: 25 1 26 2012-02-21 MORITA Hajime <morrita@google.com> 2 27 -
trunk/Source/WebCore/GNUmakefile.list.am
r108438 r108450 2741 2741 Source/WebCore/page/NavigatorBase.cpp \ 2742 2742 Source/WebCore/page/NavigatorBase.h \ 2743 Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp \ 2744 Source/WebCore/page/NavigatorRegisterProtocolHandler.h \ 2743 2745 Source/WebCore/page/NavigatorSupplement.cpp \ 2744 2746 Source/WebCore/page/NavigatorSupplement.h \ -
trunk/Source/WebCore/Target.pri
r108438 r108450 1002 1002 page/Navigator.cpp \ 1003 1003 page/NavigatorBase.cpp \ 1004 page/NavigatorRegisterProtocolHandler.cpp \ 1004 1005 page/NavigatorSupplement.cpp \ 1005 1006 page/OriginAccessEntry.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r108438 r108450 1013 1013 'page/MemoryInfo.idl', 1014 1014 'page/Navigator.idl', 1015 'page/NavigatorRegisterProtocolHandler.idl', 1015 1016 'page/Performance.idl', 1016 1017 'page/PerformanceNavigation.idl', … … 2643 2644 'page/NavigatorBase.cpp', 2644 2645 'page/NavigatorBase.h', 2646 'page/NavigatorRegisterProtocolHandler.cpp', 2647 'page/NavigatorRegisterProtocolHandler.h', 2645 2648 'page/NavigatorSupplement.cpp', 2646 2649 'page/NavigatorSupplement.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r108428 r108450 25587 25587 </File> 25588 25588 <File 25589 RelativePath="..\page\NavigatorRegisterProtocolHandler.cpp" 25590 > 25591 </File> 25592 <File 25593 RelativePath="..\page\NavigatorRegisterProtocolHandler.h" 25594 > 25595 </File> 25596 <File 25589 25597 RelativePath="..\page\NavigatorSupplement.cpp" 25590 25598 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r108428 r108450 3460 3460 97E4028F13A696ED00913D67 /* IconController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E4028D13A696ED00913D67 /* IconController.cpp */; }; 3461 3461 97E4029013A696ED00913D67 /* IconController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E4028E13A696ED00913D67 /* IconController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3462 97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */; }; 3463 97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */; }; 3462 3464 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; }; 3463 3465 984264F112D5280A000D88A4 /* LinkLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 984264EF12D5280A000D88A4 /* LinkLoaderClient.h */; }; … … 10204 10206 9728C3111268E4390041E89B /* MarkupAccumulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkupAccumulator.cpp; sourceTree = "<group>"; }; 10205 10207 9728C3121268E4390041E89B /* MarkupAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkupAccumulator.h; sourceTree = "<group>"; }; 10208 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorRegisterProtocolHandler.cpp; sourceTree = "<group>"; }; 10209 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorRegisterProtocolHandler.h; sourceTree = "<group>"; }; 10210 9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorRegisterProtocolHandler.idl; sourceTree = "<group>"; }; 10206 10211 9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentWriter.cpp; sourceTree = "<group>"; }; 10207 10212 9738899F116EA9DC00ADF313 /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; }; … … 15283 15288 E12719C90EEEC21300F61213 /* NavigatorBase.cpp */, 15284 15289 E12719C60EEEC16800F61213 /* NavigatorBase.h */, 15290 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */, 15291 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */, 15292 9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */, 15285 15293 97CC3AE014E8E4A200894988 /* NavigatorSupplement.cpp */, 15286 15294 97CC3AE114E8E4A200894988 /* NavigatorSupplement.h */, … … 19214 19222 isa = PBXGroup; 19215 19223 children = ( 19216 A83B533814F399BB00720D9D /* IDLAttributes.txt */,19217 19224 B5D31DF711CF60E5009F22B4 /* generic */, 19218 19225 BC1A3793097C6FB10019F3D8 /* js */, … … 19220 19227 93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */, 19221 19228 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */, 19229 A83B533814F399BB00720D9D /* IDLAttributes.txt */, 19222 19230 14813BF309EDF88E00F757E1 /* IDLParser.pm */, 19223 19231 93F8B3080A300FEA00F61AB8 /* IDLStructure.pm */, … … 22359 22367 41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */, 22360 22368 935C476D09AC4D6300A6AAB4 /* FoundationExtras.h in Headers */, 22369 144FCFE114EF2509000D17A3 /* FractionalLayoutRect.h in Headers */, 22361 22370 144FCE5D14EC79E7000D17A3 /* FractionalLayoutSize.h in Headers */, 22362 22371 144FCE5214EC79BC000D17A3 /* FractionalLayoutUnit.h in Headers */, … … 23314 23323 E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */, 23315 23324 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */, 23325 97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */, 23316 23326 97CC3AE314E8E4A200894988 /* NavigatorSupplement.h in Headers */, 23317 23327 8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */, … … 23450 23460 A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */, 23451 23461 1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */, 23462 E4BBED0F14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.h in Headers */, 23452 23463 514C76750CE923A1007EF3CD /* ProtectionSpace.h in Headers */, 23453 23464 51A052561058874000CC9E95 /* ProtectionSpaceHash.h in Headers */, … … 24322 24333 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, 24323 24334 FD537353137B651800008DCE /* ZeroPole.h in Headers */, 24324 E4BBED0F14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.h in Headers */,24325 144FCFE114EF2509000D17A3 /* FractionalLayoutRect.h in Headers */,24326 24335 ); 24327 24336 runOnlyForDeploymentPostprocessing = 0; … … 25435 25444 656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */, 25436 25445 41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */, 25446 144FCFE014EF2509000D17A3 /* FractionalLayoutRect.cpp in Sources */, 25437 25447 144FCE5C14EC79E7000D17A3 /* FractionalLayoutSize.cpp in Sources */, 25438 25448 65BF022E0974816300C43196 /* Frame.cpp in Sources */, … … 26470 26480 E12719CA0EEEC21300F61213 /* NavigatorBase.cpp in Sources */, 26471 26481 9711460314EF009A00674FD9 /* NavigatorGeolocation.cpp in Sources */, 26482 97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */, 26472 26483 97CC3AE214E8E4A200894988 /* NavigatorSupplement.cpp in Sources */, 26473 26484 5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */, … … 26565 26576 A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */, 26566 26577 1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */, 26578 E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */, 26567 26579 514C76740CE923A1007EF3CD /* ProtectionSpace.cpp in Sources */, 26568 26580 1AF8E13312565A4400230FF7 /* ProxyServer.cpp in Sources */, … … 27192 27204 518A34C11026C831001B6896 /* WebSocket.cpp in Sources */, 27193 27205 510D4A4E103177A20049EA54 /* WebSocketChannel.cpp in Sources */, 27206 4AE02ABD14E8A9D200BC3BA7 /* WebSocketDeflater.cpp in Sources */, 27194 27207 4A957F0614E2412A0049DBFB /* WebSocketExtensionDispatcher.cpp in Sources */, 27195 4AE02ABD14E8A9D200BC3BA7 /* WebSocketDeflater.cpp in Sources */,27196 27208 51ABAE441043AB4A008C5260 /* WebSocketHandshake.cpp in Sources */, 27197 27209 7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */, … … 27271 27283 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, 27272 27284 FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, 27273 E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */,27274 144FCFE014EF2509000D17A3 /* FractionalLayoutRect.cpp in Sources */,27275 27285 ); 27276 27286 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/page/Navigator.cpp
r108428 r108450 24 24 #include "Navigator.h" 25 25 26 #include "Chrome.h"27 26 #include "CookieJar.h" 28 27 #include "DOMMimeTypeArray.h" 29 28 #include "DOMPluginArray.h" 30 29 #include "Document.h" 31 #include "ExceptionCode.h"32 30 #include "Frame.h" 33 31 #include "FrameLoader.h" 34 32 #include "FrameLoaderClient.h" 35 33 #include "Geolocation.h" 34 #include "Page.h" 36 35 #include "PointerLock.h" 37 #include "KURL.h"38 36 #include "Language.h" 39 #include "Page.h"40 #include "PageGroup.h"41 #include "PlatformString.h"42 37 #include "PluginData.h" 43 38 #include "Settings.h" … … 160 155 } 161 156 162 #if ENABLE(REGISTER_PROTOCOL_HANDLER)163 static HashSet<String>* protocolWhitelist;164 165 static void initProtocolHandlerWhitelist()166 {167 protocolWhitelist = new HashSet<String>;168 static const char* protocols[] = {169 "irc",170 "mailto",171 "mms",172 "news",173 "nntp",174 "sms",175 "smsto",176 "tel",177 "urn",178 "webcal",179 };180 for (size_t i = 0; i < WTF_ARRAY_LENGTH(protocols); ++i)181 protocolWhitelist->add(protocols[i]);182 }183 184 static bool verifyCustomHandlerURL(const String& baseURL, const String& url, ExceptionCode& ec)185 {186 // The specification requires that it is a SYNTAX_ERR if the "%s" token is187 // not present.188 static const char token[] = "%s";189 int index = url.find(token);190 if (-1 == index) {191 ec = SYNTAX_ERR;192 return false;193 }194 195 // It is also a SYNTAX_ERR if the custom handler URL, as created by removing196 // the "%s" token and prepending the base url, does not resolve.197 String newURL = url;198 newURL.remove(index, WTF_ARRAY_LENGTH(token) - 1);199 200 KURL base(ParsedURLString, baseURL);201 KURL kurl(base, newURL);202 203 if (kurl.isEmpty() || !kurl.isValid()) {204 ec = SYNTAX_ERR;205 return false;206 }207 208 return true;209 }210 211 static bool isProtocolWhitelisted(const String& scheme)212 {213 if (!protocolWhitelist)214 initProtocolHandlerWhitelist();215 return protocolWhitelist->contains(scheme);216 }217 218 static bool verifyProtocolHandlerScheme(const String& scheme, ExceptionCode& ec)219 {220 if (scheme.startsWith("web+")) {221 if (isValidProtocol(scheme))222 return true;223 ec = SECURITY_ERR;224 return false;225 }226 227 if (isProtocolWhitelisted(scheme))228 return true;229 ec = SECURITY_ERR;230 return false;231 }232 233 void Navigator::registerProtocolHandler(const String& scheme, const String& url, const String& title, ExceptionCode& ec)234 {235 if (!m_frame)236 return;237 238 Document* document = m_frame->document();239 if (!document)240 return;241 242 String baseURL = document->baseURL().baseAsString();243 244 if (!verifyCustomHandlerURL(baseURL, url, ec))245 return;246 247 if (!verifyProtocolHandlerScheme(scheme, ec))248 return;249 250 Page* page = m_frame->page();251 if (!page)252 return;253 254 page->chrome()->registerProtocolHandler(scheme, baseURL, url, m_frame->displayStringModifiedByEncoding(title));255 }256 #endif257 258 157 } // namespace WebCore -
trunk/Source/WebCore/page/Navigator.h
r108428 r108450 61 61 void getStorageUpdates(); 62 62 63 #if ENABLE(REGISTER_PROTOCOL_HANDLER)64 void registerProtocolHandler(const String& scheme, const String& url, const String& title, ExceptionCode&);65 #endif66 67 63 void provideSupplement(const AtomicString&, PassOwnPtr<NavigatorSupplement>); 68 64 NavigatorSupplement* requireSupplement(const AtomicString&); -
trunk/Source/WebCore/page/Navigator.idl
r108428 r108450 46 46 47 47 void getStorageUpdates(); // FIXME: Remove this method or rename to yieldForStorageUpdates. 48 49 #if defined(ENABLE_REGISTER_PROTOCOL_HANDLER) && ENABLE_REGISTER_PROTOCOL_HANDLER50 void registerProtocolHandler(in DOMString scheme, in DOMString url, in DOMString title)51 raises(DOMException);52 #endif53 48 }; 54 49
Note: See TracChangeset
for help on using the changeset viewer.