Пример #1
0
void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
    RefPtrWillBeRawPtr<ExecutionContext> contextPtr(context);
    RefPtr<CallbackWrapper> wrapper = adoptRef(new CallbackWrapper(callbacks));
    requestFileSystemAccessInternal(context,
        bind(&LocalFileSystem::fileSystemAllowedInternal, this, contextPtr, type, wrapper),
        bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, wrapper));
}
void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSystemURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
    RawPtr<ExecutionContext> contextPtr(context);
    CallbackWrapper* wrapper = new CallbackWrapper(callbacks);
    requestFileSystemAccessInternal(context,
        bind(&LocalFileSystem::resolveURLInternal, this, contextPtr, fileSystemURL, wrapper),
        bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, wrapper));
}
Пример #3
0
void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
    RefPtrWillBeRawPtr<ExecutionContext> contextPtr(context);
    ASSERT(context);
    ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument());

    RefPtr<CallbackWrapper> wrapper = adoptRef(new CallbackWrapper(callbacks));
    requestFileSystemAccessInternal(context,
        bind(&LocalFileSystem::deleteFileSystemInternal, this, contextPtr, type, wrapper),
        bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, wrapper));
}
Пример #4
0
void
ThreadStackHelper::GetNativeStack(Stack& aStack)
{
#ifdef MOZ_THREADSTACKHELPER_NATIVE
  ThreadContext context;
  context.mStack = MakeUnique<uint8_t[]>(ThreadContext::kMaxStackSize);

  ScopedSetPtr<ThreadContext> contextPtr(mContextToFill, &context);

  // Get pseudostack first and fill the thread context.
  GetStack(aStack);
  NS_ENSURE_TRUE_VOID(context.mValid);

  // TODO: walk the saved stack frames.
#endif // MOZ_THREADSTACKHELPER_NATIVE
}
// -----------------------------------------------------------------------------
// RRoapStorageClient::AddDomainContextL
// Add a new Domain Context to the ROAP storage
// -----------------------------------------------------------------------------
//
EXPORT_C void Roap::RRoapStorageClient::AddDomainContextL(
    const CDRMDomainContext& aDomainContext,
    const RPointerArray<HBufC8>& aMacs,
    const RPointerArray<HBufC8>& aDomainKeyElements,
    TKeyTransportScheme& aTransportScheme )
    {
    TPckg<TKeyTransportScheme> package( aTransportScheme );
    HBufC8* contextData = aDomainContext.ExportL();
    CleanupStack::PushL( contextData );
    TInt size = aDomainContext.Size();
    TPtr8 contextPtr( NULL, 0 );
    TPtr8 domainXmltPtr( 0, 0 );
    TPtr8 macValuesPtr( 0, 0 );
    HBufC8* domainXml = NULL;
    HBufC8* macValues = NULL;

    domainXml = ArrayToBufferLC( aDomainKeyElements );
    macValues = ArrayToBufferLC( aMacs );

    if ( size && domainXml && macValues )
        {
        contextPtr.Set( const_cast<TUint8*> ( contextData->Ptr() ), size,
            size );
        domainXmltPtr.Set( domainXml->Des() );
        macValuesPtr.Set( macValues->Des() );

        User::LeaveIfError( SendReceive( Roap::EAddDomainContext, TIpcArgs(
            &contextPtr, &package, &macValuesPtr, &domainXmltPtr ) ) );
        }
    else
        {
        User::Leave( KErrArgument );
        }
    CleanupStack::PopAndDestroy( macValues );
    CleanupStack::PopAndDestroy( domainXml );
    CleanupStack::PopAndDestroy( contextData );
    }
void
ThreadStackHelper::GetNativeStack(Stack& aStack)
{
#ifdef MOZ_THREADSTACKHELPER_NATIVE
  ThreadContext context;
  context.mStack = MakeUnique<uint8_t[]>(ThreadContext::kMaxStackSize);

  ScopedSetPtr<ThreadContext> contextPtr(mContextToFill, &context);

  // Get pseudostack first and fill the thread context.
  GetStack(aStack);
  NS_ENSURE_TRUE_VOID(context.mValid);

  CodeModulesProvider modulesProvider;
  google_breakpad::BasicCodeModules modules(&modulesProvider);
  google_breakpad::BasicSourceLineResolver resolver;
  google_breakpad::StackFrameSymbolizer symbolizer(nullptr, &resolver);

#if defined(MOZ_THREADSTACKHELPER_X86)
  google_breakpad::StackwalkerX86 stackWalker(
    nullptr, &context.mContext, &context, &modules, &symbolizer);
#elif defined(MOZ_THREADSTACKHELPER_X64)
  google_breakpad::StackwalkerAMD64 stackWalker(
    nullptr, &context.mContext, &context, &modules, &symbolizer);
#elif defined(MOZ_THREADSTACKHELPER_ARM)
  google_breakpad::StackwalkerARM stackWalker(
    nullptr, &context.mContext, -1, &context, &modules, &symbolizer);
#else
  #error "Unsupported architecture"
#endif

  google_breakpad::CallStack callStack;
  std::vector<const google_breakpad::CodeModule*> modules_without_symbols;

  google_breakpad::Stackwalker::set_max_frames(ThreadContext::kMaxStackFrames);
  google_breakpad::Stackwalker::
    set_max_frames_scanned(ThreadContext::kMaxStackFrames);

  NS_ENSURE_TRUE_VOID(stackWalker.Walk(&callStack, &modules_without_symbols));

  const std::vector<google_breakpad::StackFrame*>& frames(*callStack.frames());
  for (intptr_t i = frames.size() - 1; i >= 0; i--) {
    const google_breakpad::StackFrame& frame = *frames[i];
    if (!frame.module) {
      continue;
    }
    const string& module = frame.module->code_file();
#if defined(XP_LINUX) || defined(XP_MACOSX)
    const char PATH_SEP = '/';
#elif defined(XP_WIN)
    const char PATH_SEP = '\\';
#endif
    const char* const module_basename = strrchr(module.c_str(), PATH_SEP);
    const char* const module_name = module_basename ?
                                    module_basename + 1 : module.c_str();

    char buffer[0x100];
    size_t len = 0;
    if (!frame.function_name.empty()) {
      len = PR_snprintf(buffer, sizeof(buffer), "%s:%s",
                        module_name, frame.function_name.c_str());
    } else {
      len = PR_snprintf(buffer, sizeof(buffer), "%s:0x%p",
                        module_name, (intptr_t)
                        (frame.instruction - frame.module->base_address()));
    }
    if (len) {
      aStack.AppendViaBuffer(buffer, len);
    }
  }
#endif // MOZ_THREADSTACKHELPER_NATIVE
}