зеркало из https://github.com/mozilla/pjs.git
Bug 609083 - 'Workers: Fix leak introduced by structured clone change'. r=jst, a=blocking+
This commit is contained in:
Родитель
4ba6ae28f4
Коммит
d547219ae6
|
@ -41,11 +41,13 @@
|
|||
#include "nsIXMLHttpRequest.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsAXPCNativeCallContext.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "nsDOMWorkerMessageHandler.h"
|
||||
#include "nsDOMThreadService.h"
|
||||
#include "nsDOMWorkerXHR.h"
|
||||
#include "nsDOMWorkerXHRProxy.h"
|
||||
|
||||
|
@ -255,6 +257,19 @@ nsDOMWorkerEvent::InitEvent(const nsAString& aEventTypeArg,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDOMWorkerMessageEvent::~nsDOMWorkerMessageEvent()
|
||||
{
|
||||
if (mData) {
|
||||
JSContext* cx = nsDOMThreadService::GetCurrentContext();
|
||||
if (cx) {
|
||||
JS_free(cx, mData);
|
||||
}
|
||||
else {
|
||||
NS_WARNING("Failed to get safe JSContext, leaking event data!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsDOMWorkerMessageEvent, nsDOMWorkerEvent,
|
||||
nsIWorkerMessageEvent)
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ public:
|
|||
NS_DECL_NSICLASSINFO_GETINTERFACES
|
||||
|
||||
nsDOMWorkerMessageEvent() : mData(nsnull) { }
|
||||
~nsDOMWorkerMessageEvent();
|
||||
|
||||
nsresult SetJSData(JSContext* aCx,
|
||||
JSAutoStructuredCloneBuffer& aBuffer);
|
||||
|
|
Загрузка…
Ссылка в новой задаче