summaryrefslogtreecommitdiffstats
path: root/WebCore/page
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-11-05 09:23:40 +0000
committerSteve Block <steveblock@google.com>2009-11-10 22:41:12 +0000
commitcac0f67c402d107cdb10971b95719e2ff9c7c76b (patch)
treed182c7f87211c6f201a5f038e332336493ebdbe7 /WebCore/page
parent4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff)
downloadexternal_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebCore/page')
-rw-r--r--WebCore/page/Console.cpp9
-rw-r--r--WebCore/page/Console.h3
-rw-r--r--WebCore/page/ContextMenuController.cpp2
-rw-r--r--WebCore/page/DOMTimer.cpp27
-rw-r--r--WebCore/page/DOMTimer.h1
-rw-r--r--WebCore/page/DOMWindow.idl25
-rw-r--r--WebCore/page/EventHandler.cpp2
-rw-r--r--WebCore/page/Frame.cpp1
-rw-r--r--WebCore/page/FrameView.cpp79
-rw-r--r--WebCore/page/FrameView.h2
-rw-r--r--WebCore/page/Geolocation.cpp45
-rw-r--r--WebCore/page/Geolocation.h6
-rw-r--r--WebCore/page/Page.cpp18
-rw-r--r--WebCore/page/Page.h2
-rw-r--r--WebCore/page/PageGroup.cpp146
-rw-r--r--WebCore/page/PageGroup.h23
-rw-r--r--WebCore/page/PluginHalter.cpp7
-rw-r--r--WebCore/page/PluginHalter.h5
-rw-r--r--WebCore/page/PluginHalterClient.h1
-rw-r--r--WebCore/page/PrintContext.cpp30
-rw-r--r--WebCore/page/SecurityOrigin.h5
-rw-r--r--WebCore/page/Settings.cpp29
-rw-r--r--WebCore/page/Settings.h19
-rw-r--r--WebCore/page/XSSAuditor.cpp46
-rw-r--r--WebCore/page/XSSAuditor.h15
-rw-r--r--WebCore/page/animation/AnimationBase.cpp2
-rw-r--r--WebCore/page/animation/AnimationController.cpp21
-rw-r--r--WebCore/page/animation/AnimationControllerPrivate.h16
-rw-r--r--WebCore/page/animation/ImplicitAnimation.cpp6
-rw-r--r--WebCore/page/animation/KeyframeAnimation.cpp6
30 files changed, 400 insertions, 199 deletions
diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp
index 51928d4..1935f56 100644
--- a/WebCore/page/Console.cpp
+++ b/WebCore/page/Console.cpp
@@ -46,9 +46,15 @@
#include "ScriptCallStack.h"
#include <stdio.h>
+<<<<<<< HEAD:WebCore/page/Console.cpp
#if PLATFORM(ANDROID)
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Console.cpp
#include <wtf/UnusedParam.h>
+<<<<<<< HEAD:WebCore/page/Console.cpp
#endif
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Console.cpp
namespace WebCore {
@@ -250,8 +256,7 @@ void Console::assertCondition(bool condition, ScriptCallStack* callStack)
if (condition)
return;
- // FIXME: <https://bugs.webkit.org/show_bug.cgi?id=19135> It would be nice to prefix assertion failures with a message like "Assertion failed: ".
- addMessage(LogMessageType, ErrorMessageLevel, callStack, true);
+ addMessage(AssertMessageType, ErrorMessageLevel, callStack, true);
}
void Console::count(ScriptCallStack* callStack)
diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h
index 08d43e3..1b93a4a 100644
--- a/WebCore/page/Console.h
+++ b/WebCore/page/Console.h
@@ -64,7 +64,8 @@ namespace WebCore {
ObjectMessageType,
TraceMessageType,
StartGroupMessageType,
- EndGroupMessageType
+ EndGroupMessageType,
+ AssertMessageType
};
enum MessageLevel {
diff --git a/WebCore/page/ContextMenuController.cpp b/WebCore/page/ContextMenuController.cpp
index 1cf0014..7d773ca 100644
--- a/WebCore/page/ContextMenuController.cpp
+++ b/WebCore/page/ContextMenuController.cpp
@@ -217,7 +217,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
break;
case ContextMenuItemTagOpenLink:
if (Frame* targetFrame = result.targetFrame())
- targetFrame->loader()->loadFrameRequest(FrameLoadRequest(ResourceRequest(result.absoluteLinkURL(), frame->loader()->outgoingReferrer())), false, false, 0, 0);
+ targetFrame->loader()->loadFrameRequest(FrameLoadRequest(ResourceRequest(result.absoluteLinkURL(), frame->loader()->outgoingReferrer())), false, false, 0, 0, SendReferrer);
else
openNewWindow(result.absoluteLinkURL(), frame);
break;
diff --git a/WebCore/page/DOMTimer.cpp b/WebCore/page/DOMTimer.cpp
index dd1e842..83bcb02 100644
--- a/WebCore/page/DOMTimer.cpp
+++ b/WebCore/page/DOMTimer.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "DOMTimer.h"
+#include "InspectorTimelineAgent.h"
#include "ScheduledAction.h"
#include "ScriptExecutionContext.h"
#include <wtf/HashSet.h>
@@ -87,6 +88,12 @@ int DOMTimer::install(ScriptExecutionContext* context, ScheduledAction* action,
// The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(),
// or if it is a one-time timer and it has fired (DOMTimer::fired).
DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
+
+#if ENABLE(INSPECTOR)
+ if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
+ timelineAgent->didInstallTimer(timer->m_timeoutId, timeout, singleShot);
+#endif
+
return timer->m_timeoutId;
}
@@ -97,6 +104,12 @@ void DOMTimer::removeById(ScriptExecutionContext* context, int timeoutId)
// respectively
if (timeoutId <= 0)
return;
+
+#if ENABLE(INSPECTOR)
+ if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
+ timelineAgent->didRemoveTimer(timeoutId);
+#endif
+
delete context->findTimeout(timeoutId);
}
@@ -105,6 +118,12 @@ void DOMTimer::fired()
ScriptExecutionContext* context = scriptExecutionContext();
timerNestingLevel = m_nestingLevel;
+#if ENABLE(INSPECTOR)
+ InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context);
+ if (timelineAgent)
+ timelineAgent->willFireTimer(m_timeoutId);
+#endif
+
// Simple case for non-one-shot timers.
if (isActive()) {
if (repeatInterval() && repeatInterval() < s_minTimerInterval) {
@@ -115,6 +134,10 @@ void DOMTimer::fired()
// No access to member variables after this point, it can delete the timer.
m_action->execute(context);
+#if ENABLE(INSPECTOR)
+ if (timelineAgent)
+ timelineAgent->didFireTimer();
+#endif
return;
}
@@ -125,6 +148,10 @@ void DOMTimer::fired()
delete this;
action->execute(context);
+#if ENABLE(INSPECTOR)
+ if (timelineAgent)
+ timelineAgent->didFireTimer();
+#endif
delete action;
timerNestingLevel = 0;
}
diff --git a/WebCore/page/DOMTimer.h b/WebCore/page/DOMTimer.h
index 3c65258..460430f 100644
--- a/WebCore/page/DOMTimer.h
+++ b/WebCore/page/DOMTimer.h
@@ -33,6 +33,7 @@
namespace WebCore {
+ class InspectorTimelineAgent;
class ScheduledAction;
class DOMTimer : public TimerBase, public ActiveDOMObject {
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index c8eafe6..dfafa35 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -163,15 +163,15 @@ module window {
readonly attribute DOMApplicationCache applicationCache;
#endif
#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
- Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize)
+ [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize)
raises(DOMException);
#endif
#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
- readonly attribute Storage sessionStorage;
- readonly attribute Storage localStorage;
+ readonly attribute [EnabledAtRuntime] Storage sessionStorage;
+ readonly attribute [EnabledAtRuntime] Storage localStorage;
#endif
#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS
- readonly attribute NotificationCenter webkitNotifications;
+ readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications;
#endif
#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
@@ -436,6 +436,7 @@ module window {
attribute HTMLUListElementConstructor HTMLUListElement;
attribute HTMLCollectionConstructor HTMLCollection;
+ attribute HTMLAllCollectionConstructor HTMLAllCollection;
attribute [CustomGetter] HTMLImageElementConstructor Image; // Usable with new operator
attribute [CustomGetter] HTMLOptionElementConstructor Option; // Usable with new operator
@@ -515,11 +516,11 @@ module window {
#endif
#if defined(ENABLE_SHARED_WORKERS) && ENABLE_SHARED_WORKERS
- attribute [JSCCustomGetter] SharedWorkerConstructor SharedWorker; // Usable with the new operator
+ attribute [JSCCustomGetter, EnabledAtRuntime] SharedWorkerConstructor SharedWorker; // Usable with the new operator
#endif
#if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS
- attribute [JSCCustomGetter] WebSocketConstructor WebSocket; // Usable with the new operator
+ attribute [JSCCustomGetter,EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator
#endif
attribute PluginConstructor Plugin;
@@ -536,11 +537,11 @@ module window {
attribute StorageEventConstructor StorageEvent;
#endif
- attribute [CustomGetter,Conditional=VIDEO] HTMLAudioElementConstructor Audio; // Usable with the new operator
- attribute [Conditional=VIDEO] HTMLAudioElementConstructor HTMLAudioElement;
- attribute [Conditional=VIDEO] HTMLMediaElementConstructor HTMLMediaElement;
- attribute [Conditional=VIDEO] HTMLVideoElementConstructor HTMLVideoElement;
- attribute [Conditional=VIDEO] MediaErrorConstructor MediaError;
+ attribute [CustomGetter, Conditional=VIDEO, EnabledAtRuntime] HTMLAudioElementConstructor Audio; // Usable with the new operator
+ attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLAudioElementConstructor HTMLAudioElement;
+ attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLMediaElementConstructor HTMLMediaElement;
+ attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLVideoElementConstructor HTMLVideoElement;
+ attribute [Conditional=VIDEO, EnabledAtRuntime] MediaErrorConstructor MediaError;
#if defined(ENABLE_XPATH) && ENABLE_XPATH
attribute XPathEvaluatorConstructor XPathEvaluator;
@@ -573,7 +574,7 @@ module window {
attribute SVGFECompositeElementConstructor SVGFECompositeElement;
// attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement;
attribute SVGFEDisplacementMapElementConstructor SVGFEDisplacementMapElement;
-// attribute SVGFEMorphologyElementConstructor SVGFEMorphologyElement;
+ attribute SVGFEMorphologyElementConstructor SVGFEMorphologyElement;
attribute SVGFETurbulenceElementConstructor SVGFETurbulenceElement;
#endif
#endif
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 6b4031e..9d45ca7 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -136,10 +136,12 @@ inline bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResu
return false;
}
+#if ENABLE(DRAG_SUPPORT)
inline bool EventHandler::eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&)
{
return false;
}
+#endif
#endif
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index da3c92b..afda0b9 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -202,6 +202,7 @@ Frame::~Frame()
if (m_domWindow)
m_domWindow->disconnectFrame();
+ script()->clearWindowShell();
HashSet<DOMWindow*>::iterator end = m_liveFormerWindows.end();
for (HashSet<DOMWindow*>::iterator it = m_liveFormerWindows.begin(); it != end; ++it)
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 587048c..5016fc7 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -52,6 +52,7 @@
#include "RenderTheme.h"
#include "RenderView.h"
#include "Settings.h"
+#include "TextResourceDecoder.h"
#include <wtf/CurrentTime.h>
#ifdef ANDROID_INSTRUMENT
@@ -63,6 +64,17 @@
#include "RenderLayerCompositor.h"
#endif
+#if ENABLE(SVG)
+#include "SVGDocument.h"
+#include "SVGLocatable.h"
+#include "SVGNames.h"
+#include "SVGPreserveAspectRatio.h"
+#include "SVGSVGElement.h"
+#include "SVGViewElement.h"
+#include "SVGViewSpec.h"
+#endif
+
+
namespace WebCore {
using namespace HTMLNames;
@@ -650,6 +662,7 @@ void FrameView::layout(bool allowSubtree)
beginDeferredRepaints();
layer->updateLayerPositions((m_doFullRepaint ? RenderLayer::DoFullRepaint : 0)
| RenderLayer::CheckForRepaint
+ | RenderLayer::IsCompositingUpdateRoot
| RenderLayer::UpdateCompositingLayers);
endDeferredRepaints();
@@ -783,6 +796,72 @@ void FrameView::restoreScrollbar()
setScrollbarsSuppressed(false);
}
+bool FrameView::scrollToFragment(const KURL& url)
+{
+ // If our URL has no ref, then we have no place we need to jump to.
+ // OTOH If CSS target was set previously, we want to set it to 0, recalc
+ // and possibly repaint because :target pseudo class may have been
+ // set (see bug 11321).
+ if (!url.hasFragmentIdentifier() && !m_frame->document()->cssTarget())
+ return false;
+
+ String fragmentIdentifier = url.fragmentIdentifier();
+ if (scrollToAnchor(fragmentIdentifier))
+ return true;
+
+ // Try again after decoding the ref, based on the document's encoding.
+ if (TextResourceDecoder* decoder = m_frame->document()->decoder())
+ return scrollToAnchor(decodeURLEscapeSequences(fragmentIdentifier, decoder->encoding()));
+
+ return false;
+}
+
+bool FrameView::scrollToAnchor(const String& name)
+{
+ ASSERT(m_frame->document());
+
+ if (!m_frame->document()->haveStylesheetsLoaded()) {
+ m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true);
+ return false;
+ }
+
+ m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false);
+
+ Element* anchorNode = m_frame->document()->findAnchor(name);
+
+#if ENABLE(SVG)
+ if (m_frame->document()->isSVGDocument()) {
+ if (name.startsWith("xpointer(")) {
+ // We need to parse the xpointer reference here
+ } else if (name.startsWith("svgView(")) {
+ RefPtr<SVGSVGElement> svg = static_cast<SVGDocument*>(m_frame->document())->rootElement();
+ if (!svg->currentView()->parseViewSpec(name))
+ return false;
+ svg->setUseCurrentView(true);
+ } else {
+ if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) {
+ RefPtr<SVGViewElement> viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0;
+ if (viewElement.get()) {
+ RefPtr<SVGSVGElement> svg = static_cast<SVGSVGElement*>(SVGLocatable::nearestViewportElement(viewElement.get()));
+ svg->inheritViewAttributes(viewElement.get());
+ }
+ }
+ }
+ // FIXME: need to decide which <svg> to focus on, and zoom to that one
+ // FIXME: need to actually "highlight" the viewTarget(s)
+ }
+#endif
+
+ m_frame->document()->setCSSTarget(anchorNode); // Setting to null will clear the current target.
+
+ // Implement the rule that "" and "top" both mean top of page as in other browsers.
+ if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
+ return false;
+
+ maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document());
+ return true;
+}
+
void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
{
m_maintainScrollPositionAnchor = anchorNode;
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index 4c900ae..3d17d2c 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -183,6 +183,8 @@ public:
void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
+ bool scrollToFragment(const KURL&);
+ bool scrollToAnchor(const String&);
void maintainScrollPositionAtAnchor(Node*);
// Methods to convert points and rects between the coordinate space of the renderer, and this view.
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index 74b3f79..184ee57 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -34,10 +34,13 @@
#include "EventNames.h"
#include "Frame.h"
#include "Page.h"
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
#include "SQLiteDatabase.h"
#include "SQLiteStatement.h"
#include "SQLiteTransaction.h"
#include "SQLValue.h"
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
namespace WebCore {
@@ -95,12 +98,15 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*)
return;
}
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
if (m_cachedPosition) {
m_successCallback->handleEvent(m_cachedPosition.get());
m_geolocation->requestReturnedCachedPosition(this);
return;
}
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
if (m_errorCallback) {
RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, "Timeout expired");
m_errorCallback->handleEvent(error.get());
@@ -148,6 +154,7 @@ void Geolocation::Watchers::getNotifiersVector(Vector<RefPtr<GeoNotifier> >& cop
copyValuesToVector(m_idToNotifierMap, copy);
}
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
static const char* databaseName = "/CachedPosition.db";
class CachedPositionManager {
@@ -286,6 +293,8 @@ RefPtr<Geoposition>* CachedPositionManager::s_cachedPosition;
String CachedPositionManager::s_databaseFile;
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
Geolocation::Geolocation(Frame* frame)
: EventListener(GeolocationEventListenerType)
, m_frame(frame)
@@ -322,7 +331,12 @@ void Geolocation::disconnectFrame()
void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
{
RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options);
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
ASSERT(notifier);
+=======
+ if (!notifier)
+ return;
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
m_oneShots.add(notifier);
}
@@ -330,9 +344,20 @@ void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallbac
int Geolocation::watchPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
{
RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options);
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
ASSERT(notifier);
+=======
+ if (!notifier)
+ return 0;
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
static int nextAvailableWatchId = 1;
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
+=======
+ // In case of overflow, make sure the ID remains positive, but reuse the ID values.
+ if (nextAvailableWatchId < 1)
+ nextAvailableWatchId = 1;
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
m_watchers.set(nextAvailableWatchId, notifier.release());
return nextAvailableWatchId++;
}
@@ -346,6 +371,7 @@ PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<Positi
if (isDenied())
notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
else {
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
if (haveSuitableCachedPosition(notifier->m_options.get())) {
ASSERT(m_cachedPositionManager->cachedPosition());
if (isAllowed())
@@ -353,12 +379,24 @@ PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<Positi
else {
m_requestsAwaitingCachedPosition.add(notifier);
requestPermission();
+=======
+ if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get()))
+ notifier->startTimerIfNeeded();
+ else {
+ if (notifier->m_errorCallback) {
+ RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, "Unable to Start");
+ notifier->m_errorCallback->handleEvent(error.get());
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
}
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
} else {
if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get()))
notifier->startTimerIfNeeded();
else
notifier->setFatalError(PositionError::create(PositionError::UNKNOWN_ERROR, "Failed to start Geolocation service"));
+=======
+ return 0;
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
}
}
@@ -438,8 +476,15 @@ void Geolocation::setIsAllowed(bool allowed)
// This may be due to either a new position from the service, or a cached
// position.
m_allowGeolocation = allowed ? Yes : No;
+<<<<<<< HEAD:WebCore/page/Geolocation.cpp
if (!isAllowed()) {
+=======
+
+ if (isAllowed())
+ makeSuccessCallbacks();
+ else {
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.cpp
RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage);
error->setIsFatal(true);
handleError(error.get());
diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h
index d9b23c4..f5e05a6 100644
--- a/WebCore/page/Geolocation.h
+++ b/WebCore/page/Geolocation.h
@@ -94,7 +94,10 @@ private:
RefPtr<PositionOptions> m_options;
Timer<GeoNotifier> m_timer;
RefPtr<PositionError> m_fatalError;
+<<<<<<< HEAD:WebCore/page/Geolocation.h
RefPtr<Geoposition> m_cachedPosition;
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.h
private:
GeoNotifier(Geolocation*, PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
@@ -136,10 +139,13 @@ private:
PassRefPtr<GeoNotifier> startRequest(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
+<<<<<<< HEAD:WebCore/page/Geolocation.h
// EventListener
virtual bool operator==(const EventListener&);
virtual void handleEvent(ScriptExecutionContext*, Event*);
+=======
+>>>>>>> webkit.org at r50258.:WebCore/page/Geolocation.h
void fatalErrorOccurred(GeoNotifier*);
void requestTimedOut(GeoNotifier*);
void requestReturnedCachedPosition(GeoNotifier*);
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 397cb72..8a685f4 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -137,7 +137,6 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
, m_customHTMLTokenizerTimeDelay(-1)
, m_customHTMLTokenizerChunkSize(-1)
, m_canStartPlugins(true)
- , m_pluginHalterClient(pluginHalterClient)
{
#if !ENABLE(CONTEXT_MENUS)
UNUSED_PARAM(contextMenuClient);
@@ -157,7 +156,10 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
ASSERT(!allPages->contains(this));
allPages->add(this);
- pluginHalterEnabledStateChanged();
+ if (pluginHalterClient) {
+ m_pluginHalter.set(new PluginHalter(pluginHalterClient));
+ m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
+ }
#if ENABLE(JAVASCRIPT_DEBUGGER)
JavaScriptDebugServer::shared().pageCreated(this);
@@ -289,7 +291,7 @@ void Page::goToItem(HistoryItem* item, FrameLoadType type)
databasePolicy = DatabasePolicyContinue;
#endif
m_mainFrame->loader()->stopAllLoaders(databasePolicy);
- m_mainFrame->loader()->goToItem(item, type);
+ m_mainFrame->loader()->history()->goToItem(item, type);
}
int Page::getHistoryLength()
@@ -733,16 +735,6 @@ InspectorTimelineAgent* Page::inspectorTimelineAgent() const
}
#endif
-void Page::pluginHalterEnabledStateChanged()
-{
- if (m_settings->pluginHalterEnabled()) {
- ASSERT(!m_pluginHalter);
- m_pluginHalter.set(new PluginHalter(m_pluginHalterClient));
- m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
- } else
- m_pluginHalter = 0;
-}
-
void Page::pluginAllowedRunTimeChanged()
{
if (m_pluginHalter)
diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h
index cab075e..4886464 100644
--- a/WebCore/page/Page.h
+++ b/WebCore/page/Page.h
@@ -193,7 +193,6 @@ namespace WebCore {
void didStartPlugin(HaltablePlugin*);
void didStopPlugin(HaltablePlugin*);
void pluginAllowedRunTimeChanged();
- void pluginHalterEnabledStateChanged();
static void setDebuggerForAllPages(JSC::Debugger*);
void setDebugger(JSC::Debugger*);
@@ -300,7 +299,6 @@ namespace WebCore {
HashSet<PluginView*> m_unstartedPlugins;
OwnPtr<PluginHalter> m_pluginHalter;
- PluginHalterClient* m_pluginHalterClient;
#if ENABLE(DOM_STORAGE)
RefPtr<StorageNamespace> m_sessionStorage;
diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp
index cf6ba37..427c240 100644
--- a/WebCore/page/PageGroup.cpp
+++ b/WebCore/page/PageGroup.cpp
@@ -200,8 +200,8 @@ StorageNamespace* PageGroup::localStorage()
}
#endif
-void PageGroup::addUserScript(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
- PassOwnPtr<Vector<String> > blacklist, unsigned worldID, UserScriptInjectionTime injectionTime)
+void PageGroup::addUserScriptToWorld(unsigned worldID, const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
+ PassOwnPtr<Vector<String> > blacklist, UserScriptInjectionTime injectionTime)
{
if (worldID == UINT_MAX)
return;
@@ -214,8 +214,8 @@ void PageGroup::addUserScript(const String& source, const KURL& url, PassOwnPtr
scriptsInWorld->append(userScript.release());
}
-void PageGroup::addUserStyleSheet(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
- PassOwnPtr<Vector<String> > blacklist, unsigned worldID)
+void PageGroup::addUserStyleSheetToWorld(unsigned worldID, const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
+ PassOwnPtr<Vector<String> > blacklist)
{
if (worldID == UINT_MAX)
return;
@@ -235,80 +235,92 @@ void PageGroup::addUserStyleSheet(const String& source, const KURL& url, PassOwn
}
}
-void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned worldID)
+void PageGroup::removeUserScriptFromWorld(unsigned worldID, const KURL& url)
{
- if (m_userScripts) {
- UserScriptMap::iterator it = m_userScripts->find(worldID);
- if (it != m_userScripts->end()) {
- UserScriptVector* scripts = it->second;
- for (int i = scripts->size() - 1; i >= 0; --i) {
- if (scripts->at(i)->url() == url)
- scripts->remove(i);
- }
-
- if (scripts->isEmpty()) {
- delete it->second;
- m_userScripts->remove(it);
- }
- }
+ if (!m_userScripts)
+ return;
+
+ UserScriptMap::iterator it = m_userScripts->find(worldID);
+ if (it == m_userScripts->end())
+ return;
+
+ UserScriptVector* scripts = it->second;
+ for (int i = scripts->size() - 1; i >= 0; --i) {
+ if (scripts->at(i)->url() == url)
+ scripts->remove(i);
}
- if (m_userStyleSheets) {
- UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
- bool sheetsChanged = false;
- if (it != m_userStyleSheets->end()) {
- UserStyleSheetVector* stylesheets = it->second;
- for (int i = stylesheets->size() - 1; i >= 0; --i) {
- if (stylesheets->at(i)->url() == url) {
- stylesheets->remove(i);
- sheetsChanged = true;
- }
- }
-
- if (stylesheets->isEmpty()) {
- delete it->second;
- m_userStyleSheets->remove(it);
- }
+ if (!scripts->isEmpty())
+ return;
+
+ delete it->second;
+ m_userScripts->remove(it);
+}
+
+void PageGroup::removeUserStyleSheetFromWorld(unsigned worldID, const KURL& url)
+{
+ if (!m_userStyleSheets)
+ return;
+
+ UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
+ bool sheetsChanged = false;
+ if (it == m_userStyleSheets->end())
+ return;
+
+ UserStyleSheetVector* stylesheets = it->second;
+ for (int i = stylesheets->size() - 1; i >= 0; --i) {
+ if (stylesheets->at(i)->url() == url) {
+ stylesheets->remove(i);
+ sheetsChanged = true;
}
+ }
- // Clear our cached sheets and have them just reparse.
- if (sheetsChanged) {
- HashSet<Page*>::const_iterator end = m_pages.end();
- for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
- for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
- frame->document()->clearPageGroupUserSheets();
- }
- }
+ if (!sheetsChanged)
+ return;
+
+ if (!stylesheets->isEmpty()) {
+ delete it->second;
+ m_userStyleSheets->remove(it);
+ }
+
+ // Clear our cached sheets and have them just reparse.
+ HashSet<Page*>::const_iterator end = m_pages.end();
+ for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
+ for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ frame->document()->clearPageGroupUserSheets();
}
}
-void PageGroup::removeUserContentForWorld(unsigned worldID)
+void PageGroup::removeUserScriptsFromWorld(unsigned worldID)
{
- if (m_userScripts) {
- UserScriptMap::iterator it = m_userScripts->find(worldID);
- if (it != m_userScripts->end()) {
- delete it->second;
- m_userScripts->remove(it);
- }
- }
+ if (!m_userScripts)
+ return;
+
+ UserScriptMap::iterator it = m_userScripts->find(worldID);
+ if (it == m_userScripts->end())
+ return;
+
+ delete it->second;
+ m_userScripts->remove(it);
+}
+
+void PageGroup::removeUserStyleSheetsFromWorld(unsigned worldID)
+{
+ if (!m_userStyleSheets)
+ return;
- if (m_userStyleSheets) {
- bool sheetsChanged = false;
- UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
- if (it != m_userStyleSheets->end()) {
- delete it->second;
- m_userStyleSheets->remove(it);
- sheetsChanged = true;
- }
+ UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
+ if (it == m_userStyleSheets->end())
+ return;
- if (sheetsChanged) {
- // Clear our cached sheets and have them just reparse.
- HashSet<Page*>::const_iterator end = m_pages.end();
- for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
- for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
- frame->document()->clearPageGroupUserSheets();
- }
- }
+ delete it->second;
+ m_userStyleSheets->remove(it);
+
+ // Clear our cached sheets and have them just reparse.
+ HashSet<Page*>::const_iterator end = m_pages.end();
+ for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
+ for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ frame->document()->clearPageGroupUserSheets();
}
}
diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h
index 7ea2967..c233cd1 100644
--- a/WebCore/page/PageGroup.h
+++ b/WebCore/page/PageGroup.h
@@ -70,20 +70,23 @@ namespace WebCore {
bool hasLocalStorage() { return m_localStorage; }
#endif
- void addUserScript(const String& source, const KURL&,
- PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
- unsigned worldID, UserScriptInjectionTime);
- const UserScriptMap* userScripts() const { return m_userScripts.get(); }
+ void addUserScriptToWorld(unsigned worldID, const String& source, const KURL&,
+ PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
+ UserScriptInjectionTime);
+ void addUserStyleSheetToWorld(unsigned worldID, const String& source, const KURL&,
+ PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist);
- void addUserStyleSheet(const String& source, const KURL&,
- PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
- unsigned worldID);
- const UserStyleSheetMap* userStyleSheets() const { return m_userStyleSheets.get(); }
+ void removeUserScriptFromWorld(unsigned, const KURL&);
+ void removeUserStyleSheetFromWorld(unsigned, const KURL&);
- void removeUserContentForWorld(unsigned);
- void removeUserContentWithURLForWorld(const KURL&, unsigned);
+ void removeUserScriptsFromWorld(unsigned);
+ void removeUserStyleSheetsFromWorld(unsigned);
+
void removeAllUserContent();
+ const UserScriptMap* userScripts() const { return m_userScripts.get(); }
+ const UserStyleSheetMap* userStyleSheets() const { return m_userStyleSheets.get(); }
+
private:
void addVisitedLink(LinkHash stringHash);
diff --git a/WebCore/page/PluginHalter.cpp b/WebCore/page/PluginHalter.cpp
index 8025337..63f5469 100644
--- a/WebCore/page/PluginHalter.cpp
+++ b/WebCore/page/PluginHalter.cpp
@@ -28,7 +28,6 @@
#include "PluginHalter.h"
#include "HaltablePlugin.h"
-#include "PluginHalterClient.h"
#include <wtf/CurrentTime.h>
#include <wtf/Vector.h>
@@ -49,6 +48,9 @@ void PluginHalter::didStartPlugin(HaltablePlugin* obj)
ASSERT_ARG(obj, obj);
ASSERT_ARG(obj, !m_plugins.contains(obj));
+ if (!m_client->enabled())
+ return;
+
double currentTime = WTF::currentTime();
m_plugins.add(obj, currentTime);
@@ -61,6 +63,9 @@ void PluginHalter::didStartPlugin(HaltablePlugin* obj)
void PluginHalter::didStopPlugin(HaltablePlugin* obj)
{
+ if (!m_client->enabled())
+ return;
+
m_plugins.remove(obj);
}
diff --git a/WebCore/page/PluginHalter.h b/WebCore/page/PluginHalter.h
index 26f5101..eddce34 100644
--- a/WebCore/page/PluginHalter.h
+++ b/WebCore/page/PluginHalter.h
@@ -26,13 +26,14 @@
#ifndef PluginHalter_h
#define PluginHalter_h
+#include "PluginHalterClient.h"
#include "Timer.h"
#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
namespace WebCore {
class HaltablePlugin;
-class PluginHalterClient;
class PluginHalter {
public:
@@ -47,7 +48,7 @@ private:
void timerFired(Timer<PluginHalter>*);
void startTimerIfNecessary();
- PluginHalterClient* m_client;
+ OwnPtr<PluginHalterClient> m_client;
Timer<PluginHalter> m_timer;
unsigned m_pluginAllowedRunTime;
double m_oldestStartTime;
diff --git a/WebCore/page/PluginHalterClient.h b/WebCore/page/PluginHalterClient.h
index 7ea460a..f77091f 100644
--- a/WebCore/page/PluginHalterClient.h
+++ b/WebCore/page/PluginHalterClient.h
@@ -35,6 +35,7 @@ public:
virtual ~PluginHalterClient() { }
virtual bool shouldHaltPlugin(Node*) const = 0;
+ virtual bool enabled() const = 0;
};
} // namespace WebCore
diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp
index 4d3a839..bba678a 100644
--- a/WebCore/page/PrintContext.cpp
+++ b/WebCore/page/PrintContext.cpp
@@ -25,6 +25,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "RenderView.h"
+#include "Settings.h"
using namespace WebCore;
@@ -95,18 +96,23 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
void PrintContext::begin(float width)
{
- // By imaging to a width a little wider than the available pixels,
- // thin pages will be scaled down a little, matching the way they
- // print in IE and Camino. This lets them use fewer sheets than they
- // would otherwise, which is presumably why other browsers do this.
- // Wide pages will be scaled down more than this.
- const float PrintingMinimumShrinkFactor = 1.25f;
-
- // This number determines how small we are willing to reduce the page content
- // in order to accommodate the widest line. If the page would have to be
- // reduced smaller to make the widest line fit, we just clip instead (this
- // behavior matches MacIE and Mozilla, at least)
- const float PrintingMaximumShrinkFactor = 2.0f;
+ float PrintingMinimumShrinkFactor = m_frame->settings() ? m_frame->settings()->printingMinimumShrinkFactor() : 0.0f;
+ float PrintingMaximumShrinkFactor = m_frame->settings() ? m_frame->settings()->printingMaximumShrinkFactor() : 0.0f;
+
+ if (PrintingMaximumShrinkFactor < PrintingMinimumShrinkFactor || PrintingMinimumShrinkFactor <= 0.0f) {
+ // By imaging to a width a little wider than the available pixels,
+ // thin pages will be scaled down a little, matching the way they
+ // print in IE and Camino. This lets them use fewer sheets than they
+ // would otherwise, which is presumably why other browsers do this.
+ // Wide pages will be scaled down more than this.
+ PrintingMinimumShrinkFactor = 1.25f;
+
+ // This number determines how small we are willing to reduce the page content
+ // in order to accommodate the widest line. If the page would have to be
+ // reduced smaller to make the widest line fit, we just clip instead (this
+ // behavior matches MacIE and Mozilla, at least)
+ PrintingMaximumShrinkFactor = 2.0f;
+ }
float minLayoutWidth = width * PrintingMinimumShrinkFactor;
float maxLayoutWidth = width * PrintingMaximumShrinkFactor;
diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h
index 46e6fad..6d4ce1f 100644
--- a/WebCore/page/SecurityOrigin.h
+++ b/WebCore/page/SecurityOrigin.h
@@ -127,9 +127,8 @@ namespace WebCore {
// SecurityOrigin is represented with the string "null".
String toString() const;
- // Serialize the security origin for storage in the database. This format is
- // deprecated and should be used only for compatibility with old databases;
- // use toString() and createFromString() instead.
+ // Serialize the security origin to a string that could be used as part of
+ // file names. This format should be used in storage APIs only.
String databaseIdentifier() const;
// This method checks for equality between SecurityOrigins, not whether
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index df42718..d848e1c 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -75,6 +75,8 @@ Settings::Settings(Page* page)
, m_maximumDecodedImageSize(numeric_limits<size_t>::max())
, m_localStorageQuota(5 * 1024 * 1024) // Suggested by the HTML5 spec.
, m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
+ , m_printingMinimumShrinkFactor(0.0f)
+ , m_printingMaximumShrinkFactor(0.0f)
, m_isJavaEnabled(false)
, m_loadsImagesAutomatically(false)
, m_privateBrowsingEnabled(false)
@@ -129,11 +131,7 @@ Settings::Settings(Page* page)
, m_xssAuditorEnabled(false)
, m_acceleratedCompositingEnabled(true)
, m_experimentalNotificationsEnabled(false)
- , m_pluginHalterEnabled(false)
, m_webGLEnabled(false)
-#if ENABLE(WEB_SOCKETS)
- , m_experimentalWebSocketsEnabled(false)
-#endif
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
@@ -642,16 +640,6 @@ void Settings::setExperimentalNotificationsEnabled(bool enabled)
m_experimentalNotificationsEnabled = enabled;
}
-void Settings::setPluginHalterEnabled(bool enabled)
-{
- if (m_pluginHalterEnabled == enabled)
- return;
-
- m_pluginHalterEnabled = enabled;
-
- m_page->pluginHalterEnabledStateChanged();
-}
-
void Settings::setPluginAllowedRunTime(unsigned runTime)
{
m_pluginAllowedRunTime = runTime;
@@ -670,11 +658,14 @@ void Settings::setWebGLEnabled(bool enabled)
m_webGLEnabled = enabled;
}
-#if ENABLE(WEB_SOCKETS)
-void Settings::setExperimentalWebSocketsEnabled(bool enabled)
+void Settings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)
{
- m_experimentalWebSocketsEnabled = enabled;
-}
-#endif
+ m_printingMinimumShrinkFactor = printingMinimumShrinkFactor;
+}
+
+void Settings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)
+{
+ m_printingMaximumShrinkFactor = printingMaximumShrinkFactor;
+}
} // namespace WebCore
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index f03e792..b2eb7fa 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -306,19 +306,17 @@ namespace WebCore {
static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
#endif
- void setPluginHalterEnabled(bool);
- bool pluginHalterEnabled() const { return m_pluginHalterEnabled; }
-
void setPluginAllowedRunTime(unsigned);
unsigned pluginAllowedRunTime() const { return m_pluginAllowedRunTime; }
void setWebGLEnabled(bool);
bool webGLEnabled() const { return m_webGLEnabled; }
-#if ENABLE(WEB_SOCKETS)
- void setExperimentalWebSocketsEnabled(bool);
- bool experimentalWebSocketsEnabled() const { return m_experimentalWebSocketsEnabled; }
-#endif
+ void setPrintingMinimumShrinkFactor(float);
+ float printingMinimumShrinkFactor() const { return m_printingMinimumShrinkFactor; }
+
+ void setPrintingMaximumShrinkFactor(float);
+ float printingMaximumShrinkFactor() const { return m_printingMaximumShrinkFactor; }
private:
Page* m_page;
@@ -379,6 +377,8 @@ namespace WebCore {
size_t m_maximumDecodedImageSize;
unsigned m_localStorageQuota;
unsigned m_pluginAllowedRunTime;
+ float m_printingMinimumShrinkFactor;
+ float m_printingMaximumShrinkFactor;
bool m_isJavaEnabled : 1;
bool m_loadsImagesAutomatically : 1;
bool m_privateBrowsingEnabled : 1;
@@ -424,13 +424,8 @@ namespace WebCore {
bool m_xssAuditorEnabled : 1;
bool m_acceleratedCompositingEnabled : 1;
bool m_experimentalNotificationsEnabled : 1;
- bool m_pluginHalterEnabled : 1;
bool m_webGLEnabled : 1;
-#if ENABLE(WEB_SOCKETS)
- bool m_experimentalWebSocketsEnabled : 1;
-#endif
-
#if USE(SAFARI_THEME)
static bool gShouldPaintNativeControls;
#endif
diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp
index 92ed896..890c3fa 100644
--- a/WebCore/page/XSSAuditor.cpp
+++ b/WebCore/page/XSSAuditor.cpp
@@ -65,20 +65,23 @@ static bool isIllegalURICharacter(UChar c)
// in a valid URI: ', ", <, >
//
// If the request does not contain these characters then we can assume that no inline scripts have been injected
- // into response page, because it is impossible to write an inline script of the form <script>...</script>
+ // into the response page, because it is impossible to write an inline script of the form <script>...</script>
// without "<", ">".
return (c == '\'' || c == '"' || c == '<' || c == '>');
}
-String XSSAuditor::CachingURLCanonicalizer::canonicalizeURL(const String& url, const TextEncoding& encoding, bool decodeEntities)
+String XSSAuditor::CachingURLCanonicalizer::canonicalizeURL(const String& url, const TextEncoding& encoding, bool decodeEntities,
+ bool decodeURLEscapeSequencesTwice)
{
- if (decodeEntities == m_decodeEntities && encoding == m_encoding && url == m_inputURL)
+ if (decodeEntities == m_decodeEntities && decodeURLEscapeSequencesTwice == m_decodeURLEscapeSequencesTwice
+ && encoding == m_encoding && url == m_inputURL)
return m_cachedCanonicalizedURL;
- m_cachedCanonicalizedURL = canonicalize(decodeURL(url, encoding, decodeEntities));
+ m_cachedCanonicalizedURL = canonicalize(decodeURL(url, encoding, decodeEntities, decodeURLEscapeSequencesTwice));
m_inputURL = url;
m_encoding = encoding;
m_decodeEntities = decodeEntities;
+ m_decodeURLEscapeSequencesTwice = decodeURLEscapeSequencesTwice;
return m_cachedCanonicalizedURL;
}
@@ -115,7 +118,7 @@ bool XSSAuditor::canEvaluateJavaScriptURL(const String& code) const
if (!isEnabled())
return true;
- if (findInRequest(code)) {
+ if (findInRequest(code, true, false, true)) {
DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
return false;
@@ -141,6 +144,16 @@ bool XSSAuditor::canLoadExternalScriptFromSrc(const String& context, const Strin
if (!isEnabled())
return true;
+ // If the script is loaded from the same URL as the enclosing page, it's
+ // probably not an XSS attack, so we reduce false positives by allowing the
+ // script. If the script has a query string, we're more suspicious,
+ // however, because that's pretty rare and the attacker might be able to
+ // trick a server-side script into doing something dangerous with the query
+ // string.
+ KURL scriptURL(m_frame->document()->url(), url);
+ if (m_frame->document()->url().host() == scriptURL.host() && scriptURL.query().isEmpty())
+ return true;
+
if (findInRequest(context + url)) {
DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
@@ -182,7 +195,7 @@ String XSSAuditor::canonicalize(const String& string)
return result.removeCharacters(&isNonCanonicalCharacter);
}
-String XSSAuditor::decodeURL(const String& string, const TextEncoding& encoding, bool decodeEntities)
+String XSSAuditor::decodeURL(const String& string, const TextEncoding& encoding, bool decodeEntities, bool decodeURLEscapeSequencesTwice)
{
String result;
String url = string;
@@ -193,6 +206,13 @@ String XSSAuditor::decodeURL(const String& string, const TextEncoding& encoding,
String decodedResult = encoding.decode(utf8Url.data(), utf8Url.length());
if (!decodedResult.isEmpty())
result = decodedResult;
+ if (decodeURLEscapeSequencesTwice) {
+ result = decodeURLEscapeSequences(result);
+ utf8Url = result.utf8();
+ decodedResult = encoding.decode(utf8Url.data(), utf8Url.length());
+ if (!decodedResult.isEmpty())
+ result = decodedResult;
+ }
if (decodeEntities)
result = decodeHTMLEntities(result);
return result;
@@ -235,18 +255,20 @@ String XSSAuditor::decodeHTMLEntities(const String& string, bool leaveUndecodabl
return String::adopt(result);
}
-bool XSSAuditor::findInRequest(const String& string, bool decodeEntities, bool allowRequestIfNoIllegalURICharacters) const
+bool XSSAuditor::findInRequest(const String& string, bool decodeEntities, bool allowRequestIfNoIllegalURICharacters,
+ bool decodeURLEscapeSequencesTwice) const
{
bool result = false;
Frame* parentFrame = m_frame->tree()->parent();
if (parentFrame && m_frame->document()->url() == blankURL())
- result = findInRequest(parentFrame, string, decodeEntities, allowRequestIfNoIllegalURICharacters);
+ result = findInRequest(parentFrame, string, decodeEntities, allowRequestIfNoIllegalURICharacters, decodeURLEscapeSequencesTwice);
if (!result)
- result = findInRequest(m_frame, string, decodeEntities, allowRequestIfNoIllegalURICharacters);
+ result = findInRequest(m_frame, string, decodeEntities, allowRequestIfNoIllegalURICharacters, decodeURLEscapeSequencesTwice);
return result;
}
-bool XSSAuditor::findInRequest(Frame* frame, const String& string, bool decodeEntities, bool allowRequestIfNoIllegalURICharacters) const
+bool XSSAuditor::findInRequest(Frame* frame, const String& string, bool decodeEntities, bool allowRequestIfNoIllegalURICharacters,
+ bool decodeURLEscapeSequencesTwice) const
{
ASSERT(frame->document());
@@ -285,7 +307,7 @@ bool XSSAuditor::findInRequest(Frame* frame, const String& string, bool decodeEn
if (string.length() < pageURL.length()) {
// The string can actually fit inside the pageURL.
- String decodedPageURL = m_cache.canonicalizeURL(pageURL, frame->document()->decoder()->encoding(), decodeEntities);
+ String decodedPageURL = m_cache.canonicalizeURL(pageURL, frame->document()->decoder()->encoding(), decodeEntities, decodeURLEscapeSequencesTwice);
if (allowRequestIfNoIllegalURICharacters && (!formDataObj || formDataObj->isEmpty())
&& decodedPageURL.find(&isIllegalURICharacter, 0) == -1)
@@ -302,7 +324,7 @@ bool XSSAuditor::findInRequest(Frame* frame, const String& string, bool decodeEn
// the url-encoded POST data because the length of the url-decoded
// code is less than or equal to the length of the url-encoded
// string.
- String decodedFormData = m_cache.canonicalizeURL(formData, frame->document()->decoder()->encoding(), decodeEntities);
+ String decodedFormData = m_cache.canonicalizeURL(formData, frame->document()->decoder()->encoding(), decodeEntities, decodeURLEscapeSequencesTwice);
if (decodedFormData.find(canonicalizedString, 0, false) != -1)
return true; // We found the string in the POST data.
}
diff --git a/WebCore/page/XSSAuditor.h b/WebCore/page/XSSAuditor.h
index d3d1ec9..adfa5c7 100644
--- a/WebCore/page/XSSAuditor.h
+++ b/WebCore/page/XSSAuditor.h
@@ -102,25 +102,30 @@ namespace WebCore {
class CachingURLCanonicalizer
{
public:
- CachingURLCanonicalizer() : m_decodeEntities(false) { }
- String canonicalizeURL(const String& url, const TextEncoding& encoding, bool decodeEntities);
+ CachingURLCanonicalizer() : m_decodeEntities(false), m_decodeURLEscapeSequencesTwice(false) { }
+ String canonicalizeURL(const String& url, const TextEncoding& encoding, bool decodeEntities,
+ bool decodeURLEscapeSequencesTwice);
private:
// The parameters we were called with last.
String m_inputURL;
TextEncoding m_encoding;
bool m_decodeEntities;
+ bool m_decodeURLEscapeSequencesTwice;
// The cached result.
String m_cachedCanonicalizedURL;
};
static String canonicalize(const String&);
- static String decodeURL(const String& url, const TextEncoding& encoding, bool decodeEntities);
+ static String decodeURL(const String& url, const TextEncoding& encoding, bool decodeEntities,
+ bool decodeURLEscapeSequencesTwice = false);
static String decodeHTMLEntities(const String&, bool leaveUndecodableEntitiesUntouched = true);
- bool findInRequest(const String&, bool decodeEntities = true, bool allowRequestIfNoIllegalURICharacters = false) const;
- bool findInRequest(Frame*, const String&, bool decodeEntities = true, bool allowRequestIfNoIllegalURICharacters = false) const;
+ bool findInRequest(const String&, bool decodeEntities = true, bool allowRequestIfNoIllegalURICharacters = false,
+ bool decodeURLEscapeSequencesTwice = false) const;
+ bool findInRequest(Frame*, const String&, bool decodeEntities = true, bool allowRequestIfNoIllegalURICharacters = false,
+ bool decodeURLEscapeSequencesTwice = false) const;
// The frame to audit.
Frame* m_frame;
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index ec0e284..59797da 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -468,6 +468,7 @@ public:
m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::yPosition, &FillLayer::setYPosition);
break;
case CSSPropertyBackgroundSize:
+ case CSSPropertyWebkitBackgroundSize:
case CSSPropertyWebkitMaskSize:
m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::sizeLength, &FillLayer::setSizeLength);
break;
@@ -592,6 +593,7 @@ static void ensurePropertyMap()
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
+ gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
diff --git a/WebCore/page/animation/AnimationController.cpp b/WebCore/page/animation/AnimationController.cpp
index 691932e..aa5de2c 100644
--- a/WebCore/page/animation/AnimationController.cpp
+++ b/WebCore/page/animation/AnimationController.cpp
@@ -55,7 +55,7 @@ AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame)
, m_lastStyleAvailableWaiter(0)
, m_responseWaiters(0)
, m_lastResponseWaiter(0)
- , m_waitingForAResponse(false)
+ , m_waitingForResponse(false)
{
}
@@ -279,6 +279,19 @@ double AnimationControllerPrivate::beginAnimationUpdateTime()
return m_beginAnimationUpdateTime;
}
+void AnimationControllerPrivate::endAnimationUpdate()
+{
+ styleAvailable();
+ if (!m_waitingForResponse)
+ startTimeResponse(beginAnimationUpdateTime());
+}
+
+void AnimationControllerPrivate::receivedStartTimeResponse(double time)
+{
+ m_waitingForResponse = false;
+ startTimeResponse(time);
+}
+
PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer(RenderObject* renderer)
{
if (!renderer)
@@ -378,7 +391,7 @@ void AnimationControllerPrivate::addToStartTimeResponseWaitList(AnimationBase* a
ASSERT(!animation->next());
if (willGetResponse)
- m_waitingForAResponse = true;
+ m_waitingForResponse = true;
if (m_responseWaiters)
m_lastResponseWaiter->setNext(animation);
@@ -408,13 +421,13 @@ void AnimationControllerPrivate::removeFromStartTimeResponseWaitList(AnimationBa
}
}
-void AnimationControllerPrivate::startTimeResponse(double t)
+void AnimationControllerPrivate::startTimeResponse(double time)
{
// Go through list of waiters and send them on their way
for (AnimationBase* animation = m_responseWaiters; animation; ) {
AnimationBase* nextAnimation = animation->next();
animation->setNext(0);
- animation->onAnimationStartResponse(t);
+ animation->onAnimationStartResponse(time);
animation = nextAnimation;
}
diff --git a/WebCore/page/animation/AnimationControllerPrivate.h b/WebCore/page/animation/AnimationControllerPrivate.h
index 359b9b5..7db3803 100644
--- a/WebCore/page/animation/AnimationControllerPrivate.h
+++ b/WebCore/page/animation/AnimationControllerPrivate.h
@@ -80,18 +80,8 @@ public:
double beginAnimationUpdateTime();
void setBeginAnimationUpdateTime(double t) { m_beginAnimationUpdateTime = t; }
- void endAnimationUpdate()
- {
- styleAvailable();
- if (!m_waitingForAResponse)
- startTimeResponse(beginAnimationUpdateTime());
- }
-
- void receivedStartTimeResponse(double t)
- {
- m_waitingForAResponse = false;
- startTimeResponse(t);
- }
+ void endAnimationUpdate();
+ void receivedStartTimeResponse(double);
void addToStyleAvailableWaitList(AnimationBase*);
void removeFromStyleAvailableWaitList(AnimationBase*);
@@ -127,7 +117,7 @@ private:
AnimationBase* m_responseWaiters;
AnimationBase* m_lastResponseWaiter;
- bool m_waitingForAResponse;
+ bool m_waitingForResponse;
};
} // namespace WebCore
diff --git a/WebCore/page/animation/ImplicitAnimation.cpp b/WebCore/page/animation/ImplicitAnimation.cpp
index 8e6349d..50fc781 100644
--- a/WebCore/page/animation/ImplicitAnimation.cpp
+++ b/WebCore/page/animation/ImplicitAnimation.cpp
@@ -142,10 +142,8 @@ void ImplicitAnimation::onAnimationEnd(double elapsedTime)
if (keyframeAnim)
keyframeAnim->setUnanimatedStyle(m_toStyle);
- if (!sendTransitionEvent(eventNames().webkitTransitionEndEvent, elapsedTime)) {
- // We didn't dispatch an event, which would call endAnimation(), so we'll just call it here.
- endAnimation(true);
- }
+ sendTransitionEvent(eventNames().webkitTransitionEndEvent, elapsedTime);
+ endAnimation(true);
}
bool ImplicitAnimation::sendTransitionEvent(const AtomicString& eventType, double elapsedTime)
diff --git a/WebCore/page/animation/KeyframeAnimation.cpp b/WebCore/page/animation/KeyframeAnimation.cpp
index 39ae1e7..7e37e5f 100644
--- a/WebCore/page/animation/KeyframeAnimation.cpp
+++ b/WebCore/page/animation/KeyframeAnimation.cpp
@@ -244,10 +244,8 @@ void KeyframeAnimation::onAnimationIteration(double elapsedTime)
void KeyframeAnimation::onAnimationEnd(double elapsedTime)
{
- if (!sendAnimationEvent(eventNames().webkitAnimationEndEvent, elapsedTime)) {
- // We didn't dispatch an event, which would call endAnimation(), so we'll just call it here.
- endAnimation(true);
- }
+ sendAnimationEvent(eventNames().webkitAnimationEndEvent, elapsedTime);
+ endAnimation(true);
}
bool KeyframeAnimation::sendAnimationEvent(const AtomicString& eventType, double elapsedTime)