summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/win
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree/win')
-rw-r--r--WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp27
-rw-r--r--WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp38
-rw-r--r--WebKitTools/DumpRenderTree/win/EventSender.cpp25
-rw-r--r--WebKitTools/DumpRenderTree/win/EventSender.h2
-rw-r--r--WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp5
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp130
-rw-r--r--WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp33
-rw-r--r--WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp29
9 files changed, 235 insertions, 60 deletions
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
index 6b35948..255bfc3 100644
--- a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
@@ -59,6 +59,12 @@ AccessibilityController::~AccessibilityController()
JSValueUnprotect(frame->globalContext(), it->second);
}
+AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
+{
+ // FIXME: implement
+ return 0;
+}
+
AccessibilityUIElement AccessibilityController::focusedElement()
{
COMPtr<IAccessible> rootAccessible = rootElement().platformUIElement();
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
index 301112f..9f00ae4 100644
--- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
@@ -83,6 +83,18 @@ int AccessibilityUIElement::childrenCount()
return childCount;
}
+int AccessibilityUIElement::rowCount()
+{
+ // FIXME: implement
+ return 0;
+}
+
+int AccessibilityUIElement::columnCount()
+{
+ // FIXME: implement
+ return 0;
+}
+
AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
{
return 0;
@@ -224,6 +236,11 @@ JSStringRef AccessibilityUIElement::language()
return JSStringCreateWithCharacters(0, 0);
}
+JSStringRef AccessibilityUIElement::helpText() const
+{
+ return 0;
+}
+
double AccessibilityUIElement::x()
{
long x, y, width, height;
@@ -477,6 +494,11 @@ void AccessibilityUIElement::showMenu()
m_element->accDoDefaultAction(self());
}
+void AccessibilityUIElement::press()
+{
+ // FIXME: implement
+}
+
AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
{
return 0;
@@ -540,6 +562,11 @@ bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallbac
return true;
}
+void AccessibilityUIElement::removeNotificationListener()
+{
+ // FIXME: implement
+}
+
bool AccessibilityUIElement::isSelectable() const
{
DWORD state = accessibilityState(m_element);
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index ddfca95..f9b40d1 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -84,6 +84,7 @@ static bool printSeparators;
static bool leakChecking = false;
static bool threaded = false;
static bool forceComplexText = false;
+static bool printSupportedFeatures = false;
static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
volatile bool done;
@@ -731,6 +732,11 @@ static bool shouldOpenWebInspector(const char* pathOrURL)
return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\");
}
+static bool shouldEnableDeveloperExtras(const char* pathOrURL)
+{
+ return shouldOpenWebInspector(pathOrURL) || strstr(pathOrURL, "/inspector-enabled/") || strstr(pathOrURL, "\\inspector-enabled\\");
+}
+
static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
{
#ifdef USE_MAC_FONTS
@@ -790,7 +796,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
prefsPrivate->setExperimentalNotificationsEnabled(TRUE);
prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592>
prefsPrivate->setXSSAuditorEnabled(FALSE);
- prefsPrivate->setFrameSetFlatteningEnabled(FALSE);
+ prefsPrivate->setFrameFlatteningEnabled(FALSE);
prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE);
}
setAlwaysAcceptCookies(false);
@@ -836,7 +842,7 @@ static void resetWebViewToConsistentStateBeforeTesting()
SetFocus(viewWindow);
webViewPrivate->clearMainFrameName();
- webViewPrivate->resetOriginAccessWhiteLists();
+ webViewPrivate->resetOriginAccessWhitelists();
BSTR groupName;
if (SUCCEEDED(webView->groupName(&groupName))) {
@@ -910,8 +916,11 @@ static void runTest(const string& testPathOrURL)
resetWebViewToConsistentStateBeforeTesting();
- if (shouldOpenWebInspector(pathOrURL.c_str()))
- gLayoutTestController->showWebInspector();
+ if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
+ gLayoutTestController->setDeveloperExtrasEnabled(true);
+ if (shouldOpenWebInspector(pathOrURL.c_str()))
+ gLayoutTestController->showWebInspector();
+ }
prevTestBFItem = 0;
if (webView) {
@@ -947,7 +956,7 @@ static void runTest(const string& testPathOrURL)
DispatchMessage(&msg);
}
- if (shouldOpenWebInspector(pathOrURL.c_str()))
+ if (shouldEnableDeveloperExtras(pathOrURL.c_str()))
gLayoutTestController->closeWebInspector();
resetWebViewToConsistentStateBeforeTesting();
@@ -1222,6 +1231,11 @@ int main(int argc, char* argv[])
continue;
}
+ if (!stricmp(argv[i], "--print-supported-features")) {
+ printSupportedFeatures = true;
+ continue;
+ }
+
tests.append(argv[i]);
}
@@ -1246,6 +1260,20 @@ int main(int argc, char* argv[])
standardPreferences->setJavaScriptEnabled(TRUE);
standardPreferences->setDefaultFontSize(16);
+ if (printSupportedFeatures) {
+ BOOL acceleratedCompositingAvailable;
+ standardPreferences->acceleratedCompositingEnabled(&acceleratedCompositingAvailable);
+ BOOL threeDRenderingAvailable =
+#if ENABLE(3D_RENDERING)
+ true;
+#else
+ false;
+#endif
+
+ printf("SupportedFeatures:%s %s\n", acceleratedCompositingAvailable ? "AcceleratedCompositing" : "", threeDRenderingAvailable ? "3DRendering" : "");
+ return 0;
+ }
+
COMPtr<IWebView> webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow));
if (!webView)
return -1;
diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp
index 5a42b00..2a36d8d 100644
--- a/WebKitTools/DumpRenderTree/win/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/win/EventSender.cpp
@@ -667,20 +667,21 @@ static JSClassRef getClass(JSContextRef context)
return eventSenderClass;
}
-JSObjectRef makeEventSender(JSContextRef context)
+JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame)
{
- down = false;
- dragMode = true;
- replayingSavedEvents = false;
- timeOffset = 0;
- lastMousePosition.x = 0;
- lastMousePosition.y = 0;
-
- endOfQueue = 0;
- startOfQueue = 0;
+ if (isTopFrame) {
+ down = false;
+ dragMode = true;
+ replayingSavedEvents = false;
+ timeOffset = 0;
+ lastMousePosition.x = 0;
+ lastMousePosition.y = 0;
- didDragEnter = false;
- draggingInfo = 0;
+ endOfQueue = 0;
+ startOfQueue = 0;
+ didDragEnter = false;
+ draggingInfo = 0;
+ }
return JSObjectMake(context, getClass(context), 0);
}
diff --git a/WebKitTools/DumpRenderTree/win/EventSender.h b/WebKitTools/DumpRenderTree/win/EventSender.h
index 79d7dab..a0add85 100644
--- a/WebKitTools/DumpRenderTree/win/EventSender.h
+++ b/WebKitTools/DumpRenderTree/win/EventSender.h
@@ -35,7 +35,7 @@ typedef long HRESULT;
typedef const struct OpaqueJSContext* JSContextRef;
typedef struct OpaqueJSValue* JSObjectRef;
-JSObjectRef makeEventSender(JSContextRef context);
+JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame);
void replaySavedEvents(HRESULT* oleDragAndDropReturnValue = 0);
extern DraggingInfo* draggingInfo;
diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
index 37d5e1c..29f99ab 100644
--- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
@@ -336,6 +336,9 @@ void FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld(IWebFrame* f
JSGlobalContextRef context = frame->globalContext();
JSObjectRef windowObject = JSContextGetGlobalObject(context);
+ IWebFrame* parentFrame = 0;
+ frame->parentFrame(&parentFrame);
+
JSValueRef exception = 0;
::gLayoutTestController->makeWindowObject(context, windowObject, &exception);
@@ -348,7 +351,7 @@ void FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld(IWebFrame* f
ASSERT(!exception);
JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender");
- JSValueRef eventSender = makeEventSender(context);
+ JSValueRef eventSender = makeEventSender(context, !parentFrame);
JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0);
JSStringRelease(eventSenderStr);
}
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 9f84488..24ddc3b 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -110,6 +110,21 @@ void LayoutTestController::clearBackForwardList()
backForwardList->goToItem(item.get());
}
+bool LayoutTestController::callShouldCloseOnWebView()
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return false;
+
+ COMPtr<IWebViewPrivate> viewPrivate;
+ if (FAILED(webView->QueryInterface(&viewPrivate)))
+ return false;
+
+ BOOL result;
+ viewPrivate->shouldClose(&result);
+ return result;
+}
+
JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name)
{
// FIXME: Implement!
@@ -158,6 +173,33 @@ void LayoutTestController::keepWebHistory()
history->setOptionalSharedHistory(sharedHistory.get());
}
+JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
+{
+ // FIXME: Implement this.
+ return JSValueMakeUndefined(context);
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
+{
+ COMPtr<IWebFramePrivate> framePrivate(Query, frame);
+ if (!framePrivate)
+ return false;
+
+ BSTR textBSTR = 0;
+ HRESULT hr = framePrivate->layerTreeAsText(&textBSTR);
+
+ wstring text(textBSTR, SysStringLen(textBSTR));
+ SysFreeString(textBSTR);
+ JSRetainPtr<JSStringRef> textValueJS(Adopt, JSStringCreateWithCharacters(text.data(), text.length()));
+ return textValueJS;
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
+{
+ // FIXME: Implement me.
+ return JSRetainPtr<JSStringRef>();
+}
+
void LayoutTestController::waitForPolicyDelegate()
{
// FIXME: Implement this.
@@ -372,7 +414,7 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled)
prefsPrivate->setXSSAuditorEnabled(enabled);
}
-void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
+void LayoutTestController::setFrameFlatteningEnabled(bool enabled)
{
COMPtr<IWebView> webView;
if (FAILED(frame->webView(&webView)))
@@ -386,7 +428,12 @@ void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
if (!prefsPrivate)
return;
- prefsPrivate->setFrameSetFlatteningEnabled(enabled);
+ prefsPrivate->setFrameFlatteningEnabled(enabled);
+}
+
+void LayoutTestController::setSpatialNavigationEnabled(bool enabled)
+{
+ // FIXME: Implement for SpatialNavigation layout tests.
}
void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
@@ -688,19 +735,11 @@ void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
if (FAILED(webView->QueryInterface(&viewPrivate)))
return;
- COMPtr<IWebPreferences> preferences;
- if (FAILED(webView->preferences(&preferences)))
- return;
-
- COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
- if (!prefsPrivate)
- return;
-
COMPtr<IWebInspector> inspector;
if (FAILED(viewPrivate->inspector(&inspector)))
return;
- prefsPrivate->setDeveloperExtrasEnabled(flag);
+ setDeveloperExtrasEnabled(flag);
inspector->setJavaScriptProfilingEnabled(flag);
}
@@ -717,7 +756,7 @@ void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
viewEditing->setSelectTrailingWhitespaceEnabled(flag ? TRUE : FALSE);
}
-static const CFTimeInterval waitToDumpWatchdogInterval = 15.0;
+static const CFTimeInterval waitToDumpWatchdogInterval = 30.0;
static void CALLBACK waitUntilDoneWatchdogFired(HWND, UINT, UINT_PTR, DWORD)
{
@@ -950,13 +989,27 @@ static _bstr_t bstrT(JSStringRef jsString)
return _bstr_t(JSStringCopyBSTR(jsString), false);
}
-void LayoutTestController::whiteListAccessFromOrigin(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
+void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
{
COMPtr<IWebViewPrivate> webView;
if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView))))
return;
- webView->whiteListAccessFromOrigin(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains);
+ webView->addOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains);
+}
+
+void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
+{
+ COMPtr<IWebViewPrivate> webView;
+ if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView))))
+ return;
+
+ webView->removeOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains);
+}
+
+void LayoutTestController::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
+{
+ // FIXME: implement
}
void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart)
@@ -986,7 +1039,7 @@ void LayoutTestController::addUserStyleSheet(JSStringRef source)
webView->addUserStyleSheetToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), 0, 0, 0, 0, 0);
}
-void LayoutTestController::showWebInspector()
+void LayoutTestController::setDeveloperExtrasEnabled(bool enabled)
{
COMPtr<IWebView> webView;
if (FAILED(frame->webView(&webView)))
@@ -1000,7 +1053,14 @@ void LayoutTestController::showWebInspector()
if (!prefsPrivate)
return;
- prefsPrivate->setDeveloperExtrasEnabled(true);
+ prefsPrivate->setDeveloperExtrasEnabled(enabled);
+}
+
+void LayoutTestController::showWebInspector()
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
COMPtr<IWebViewPrivate> viewPrivate(Query, webView);
if (!viewPrivate)
@@ -1026,16 +1086,6 @@ void LayoutTestController::closeWebInspector()
return;
inspector->close();
-
- COMPtr<IWebPreferences> preferences;
- if (FAILED(webView->preferences(&preferences)))
- return;
-
- COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
- if (!prefsPrivate)
- return;
-
- prefsPrivate->setDeveloperExtrasEnabled(false);
}
void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
@@ -1169,3 +1219,29 @@ void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data,
{
}
+
+void LayoutTestController::apiTestGoToCurrentBackForwardItem()
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebBackForwardList> backForwardList;
+ if (FAILED(webView->backForwardList(&backForwardList)))
+ return;
+
+ COMPtr<IWebHistoryItem> item;
+ if (FAILED(backForwardList->currentItem(&item)))
+ return;
+
+ BOOL success;
+ webView->goToBackForwardItem(item.get(), &success);
+}
+
+void LayoutTestController::setWebViewEditable(bool)
+{
+}
+
+void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
+{
+}
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
index 19bf84a..2e031da 100644
--- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
@@ -31,28 +31,35 @@
#include "DumpRenderTree.h"
#include "LayoutTestController.h"
-#include <comutil.h>
#include <WebKit/WebKitCOMAPI.h>
+#include <comutil.h>
+#include <sstream>
+#include <tchar.h>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
-#include <sstream>
-
-using std::wstring;
-using std::wiostream;
+using namespace std;
static inline wstring wstringFromBSTR(BSTR str)
{
return wstring(str, ::SysStringLen(str));
}
-wstring wstringFromInt(int i)
+static inline wstring wstringFromInt(int i)
{
- std::wostringstream ss;
+ wostringstream ss;
ss << i;
return ss.str();
}
+static inline BSTR BSTRFromString(const string& str)
+{
+ int length = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), 0, 0);
+ BSTR result = ::SysAllocStringLen(0, length);
+ ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), result, length);
+ return result;
+}
+
typedef HashMap<unsigned long, wstring> IdentifierMap;
IdentifierMap& urlMap()
@@ -254,8 +261,16 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest(
return S_OK;
}
- request->AddRef();
- *newRequest = request;
+ IWebMutableURLRequest* requestCopy = 0;
+ request->mutableCopy(&requestCopy);
+ const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders();
+ for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) {
+ BSTR bstrHeader = BSTRFromString(*header);
+ requestCopy->setValue(0, bstrHeader);
+ SysFreeString(bstrHeader);
+ }
+
+ *newRequest = requestCopy;
return S_OK;
}
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
index 08a2f6a..eeacb7e 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
@@ -6,7 +6,7 @@
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in
this original Apple software (the "Apple Software"), to use, reproduce, modify and
redistribute the Apple Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the Apple Software in its entirety and without
@@ -89,7 +89,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
{
if (browser->version >= 14) {
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
-
+ instance->pdata = obj;
+
for (int16 i = 0; i < argc; i++) {
if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = _strdup(argv[i]);
@@ -107,9 +108,11 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
obj->testDocumentOpenInDestroyStream = TRUE;
else if (_stricmp(argn[i], "testwindowopen") == 0)
obj->testWindowOpen = TRUE;
+ else if (_stricmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow)
+ obj->onSetWindow = strdup(argv[i]);
}
-
- instance->pdata = obj;
+
+ browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
}
return NPERR_NO_ERROR;
@@ -136,6 +139,9 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
if (obj->logDestroy)
printf("PLUGIN: NPP_Destroy\n");
+ if (obj->onSetWindow)
+ free(obj->onSetWindow);
+
browser->releaseobject(&obj->header);
}
return NPERR_NO_ERROR;
@@ -146,6 +152,11 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (obj) {
+ obj->lastWindow = *window;
+
+ if (obj->onSetWindow)
+ executeScript(obj, obj->onSetWindow);
+
if (obj->testWindowOpen) {
testWindowOpen(instance);
obj->testWindowOpen = FALSE;
@@ -238,5 +249,13 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
{
- return NPERR_GENERIC_ERROR;
+ PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+
+ switch (variable) {
+ case NPNVprivateModeBool:
+ obj->cachedPrivateBrowsingMode = *(NPBool*)value;
+ return NPERR_NO_ERROR;
+ default:
+ return NPERR_GENERIC_ERROR;
+ }
}