2012-09-21 02:47:47 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-08-16 03:40:38 +00:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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 03:40:38 +00:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_workers_filereadersync_h__
|
|
|
|
#define mozilla_dom_workers_filereadersync_h__
|
|
|
|
|
|
|
|
#include "Workers.h"
|
|
|
|
|
2012-09-21 02:47:47 +00:00
|
|
|
class nsIInputStream;
|
2011-08-16 03:40:38 +00:00
|
|
|
|
2013-09-06 06:43:26 +00:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
namespace dom {
|
2014-10-08 16:15:23 +00:00
|
|
|
class File;
|
2013-09-06 06:43:26 +00:00
|
|
|
class GlobalObject;
|
|
|
|
template<typename> class Optional;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-16 03:40:38 +00:00
|
|
|
BEGIN_WORKERS_NAMESPACE
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class FileReaderSync final
|
2012-09-21 02:47:47 +00:00
|
|
|
{
|
2013-12-17 10:47:25 +00:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(FileReaderSync)
|
|
|
|
|
2014-04-02 16:21:03 +00:00
|
|
|
private:
|
|
|
|
// Private destructor, to discourage deletion outside of Release():
|
|
|
|
~FileReaderSync()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-09-21 02:47:47 +00:00
|
|
|
nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset,
|
|
|
|
nsAString &aResult);
|
|
|
|
|
|
|
|
public:
|
2013-09-30 04:15:37 +00:00
|
|
|
static already_AddRefed<FileReaderSync>
|
2013-08-23 05:17:08 +00:00
|
|
|
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
|
2012-09-21 02:47:47 +00:00
|
|
|
|
Bug 1117172 part 2. Change the non-wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, Codegen.py, and
StructuredClone.cpp. The rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/WrapObject\((JSContext *\* *(?:aCx|cx)),(\s*)(JS::MutableHandle<JSObject\*> aReflector)/WrapObject(\1,\2JS::Handle<JSObject*> aGivenProto,\2\3/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx)), this, aReflector/\1, this, aGivenProto, aReflector/'
2015-03-19 14:13:32 +00:00
|
|
|
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
|
2012-09-21 02:47:47 +00:00
|
|
|
|
2014-06-11 20:26:52 +00:00
|
|
|
void ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aScopeObj,
|
2014-10-08 16:15:23 +00:00
|
|
|
File& aBlob, JS::MutableHandle<JSObject*> aRetval,
|
2014-06-11 20:26:52 +00:00
|
|
|
ErrorResult& aRv);
|
2014-10-08 16:15:23 +00:00
|
|
|
void ReadAsBinaryString(File& aBlob, nsAString& aResult, ErrorResult& aRv);
|
|
|
|
void ReadAsText(File& aBlob, const Optional<nsAString>& aEncoding,
|
2012-09-21 02:47:47 +00:00
|
|
|
nsAString& aResult, ErrorResult& aRv);
|
2014-10-08 16:15:23 +00:00
|
|
|
void ReadAsDataURL(File& aBlob, nsAString& aResult, ErrorResult& aRv);
|
2012-09-21 02:47:47 +00:00
|
|
|
};
|
2011-08-16 03:40:38 +00:00
|
|
|
|
|
|
|
END_WORKERS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_filereadersync_h__
|