Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: Source/core/frame/History.cpp

Issue 307223002: Make sure we never pass a null Frame to Document::canNavigate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void History::go(ExecutionContext* context, int distance) 98 void History::go(ExecutionContext* context, int distance)
99 { 99 {
100 if (!m_frame) 100 if (!m_frame)
101 return; 101 return;
102 102
103 ASSERT(isMainThread()); 103 ASSERT(isMainThread());
104 Document* activeDocument = toDocument(context); 104 Document* activeDocument = toDocument(context);
105 if (!activeDocument) 105 if (!activeDocument)
106 return; 106 return;
107 107
108 if (!activeDocument->canNavigate(m_frame)) 108 if (!activeDocument->canNavigate(*m_frame))
109 return; 109 return;
110 110
111 m_frame->navigationScheduler().scheduleHistoryNavigation(distance); 111 m_frame->navigationScheduler().scheduleHistoryNavigation(distance);
112 } 112 }
113 113
114 KURL History::urlForState(const String& urlString) 114 KURL History::urlForState(const String& urlString)
115 { 115 {
116 Document* document = m_frame->document(); 116 Document* document = m_frame->document();
117 117
118 if (urlString.isNull()) 118 if (urlString.isNull())
(...skipping 12 matching lines...) Expand all
131 KURL fullURL = urlForState(urlString); 131 KURL fullURL = urlForState(urlString);
132 if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest (fullURL)) { 132 if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest (fullURL)) {
133 // We can safely expose the URL to JavaScript, as a) no redirection take s place: JavaScript already had this URL, b) JavaScript can only access a same-o rigin History object. 133 // We can safely expose the URL to JavaScript, as a) no redirection take s place: JavaScript already had this URL, b) JavaScript can only access a same-o rigin History object.
134 exceptionState.throwSecurityError("A history state object with URL '" + fullURL.elidedString() + "' cannot be created in a document with origin '" + m_f rame->document()->securityOrigin()->toString() + "'."); 134 exceptionState.throwSecurityError("A history state object with URL '" + fullURL.elidedString() + "' cannot be created in a document with origin '" + m_f rame->document()->securityOrigin()->toString() + "'.");
135 return; 135 return;
136 } 136 }
137 m_frame->loader().updateForSameDocumentNavigation(fullURL, SameDocumentNavig ationHistoryApi, data, type); 137 m_frame->loader().updateForSameDocumentNavigation(fullURL, SameDocumentNavig ationHistoryApi, data, type);
138 } 138 }
139 139
140 } // namespace WebCore 140 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698