2012-09-21 06:47:47 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-08-16 07:40:38 +04:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-08-16 07:40:38 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_workers_filereadersync_h__
|
|
|
|
#define mozilla_dom_workers_filereadersync_h__
|
|
|
|
|
|
|
|
#include "Workers.h"
|
|
|
|
|
2012-09-21 06:47:47 +04:00
|
|
|
class nsIInputStream;
|
|
|
|
class nsIDOMBlob;
|
2011-08-16 07:40:38 +04:00
|
|
|
|
2013-09-06 10:43:26 +04:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
class GlobalObject;
|
|
|
|
template<typename> class Optional;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-16 07:40:38 +04:00
|
|
|
BEGIN_WORKERS_NAMESPACE
|
|
|
|
|
2013-12-17 14:47:25 +04:00
|
|
|
class FileReaderSync MOZ_FINAL
|
2012-09-21 06:47:47 +04:00
|
|
|
{
|
2013-12-17 14:47:25 +04:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(FileReaderSync)
|
|
|
|
|
2014-04-02 20:21:03 +04:00
|
|
|
private:
|
|
|
|
// Private destructor, to discourage deletion outside of Release():
|
|
|
|
~FileReaderSync()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-09-21 06:47:47 +04:00
|
|
|
nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset,
|
|
|
|
nsAString &aResult);
|
|
|
|
|
|
|
|
public:
|
2013-09-30 08:15:37 +04:00
|
|
|
static already_AddRefed<FileReaderSync>
|
2013-08-23 09:17:08 +04:00
|
|
|
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
|
2012-09-21 06:47:47 +04:00
|
|
|
|
2014-04-09 02:27:18 +04:00
|
|
|
JSObject* WrapObject(JSContext* aCx);
|
2012-09-21 06:47:47 +04:00
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aScopeObj,
|
|
|
|
JS::Handle<JSObject*> aBlob,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
2013-05-16 20:36:55 +04:00
|
|
|
void ReadAsBinaryString(JS::Handle<JSObject*> aBlob, nsAString& aResult,
|
2012-09-21 06:47:47 +04:00
|
|
|
ErrorResult& aRv);
|
2013-05-16 20:36:55 +04:00
|
|
|
void ReadAsText(JS::Handle<JSObject*> aBlob,
|
|
|
|
const Optional<nsAString>& aEncoding,
|
2012-09-21 06:47:47 +04:00
|
|
|
nsAString& aResult, ErrorResult& aRv);
|
2013-05-16 20:36:55 +04:00
|
|
|
void ReadAsDataURL(JS::Handle<JSObject*> aBlob, nsAString& aResult,
|
|
|
|
ErrorResult& aRv);
|
2012-09-21 06:47:47 +04:00
|
|
|
};
|
2011-08-16 07:40:38 +04:00
|
|
|
|
|
|
|
END_WORKERS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_filereadersync_h__
|