Attachment #615917: workaround for workers needing a string origin for bug #341604

View | Details | Raw Unified | Return to bug 341604
Collapse All | Expand All

(-)a/dom/workers/WorkerPrivate.cpp (+10 lines)
Line     Link Here 
 Lines 39-54    Link Here 
39
39
40
#include "WorkerPrivate.h"
40
#include "WorkerPrivate.h"
41
41
42
#include "mozIThirdPartyUtil.h"
42
#include "mozIThirdPartyUtil.h"
43
#include "nsIClassInfo.h"
43
#include "nsIClassInfo.h"
44
#include "nsIConsoleService.h"
44
#include "nsIConsoleService.h"
45
#include "nsIDOMFile.h"
45
#include "nsIDOMFile.h"
46
#include "nsIDocument.h"
46
#include "nsIDocument.h"
47
#include "nsIDocShell.h"
47
#include "nsIJSContextStack.h"
48
#include "nsIJSContextStack.h"
48
#include "nsIMemoryReporter.h"
49
#include "nsIMemoryReporter.h"
49
#include "nsIScriptError.h"
50
#include "nsIScriptError.h"
50
#include "nsIScriptGlobalObject.h"
51
#include "nsIScriptGlobalObject.h"
51
#include "nsIScriptSecurityManager.h"
52
#include "nsIScriptSecurityManager.h"
52
#include "nsPIDOMWindow.h"
53
#include "nsPIDOMWindow.h"
53
#include "nsITextToSubURI.h"
54
#include "nsITextToSubURI.h"
54
#include "nsITimer.h"
55
#include "nsITimer.h"
 Lines 64-79    Link Here 
64
#include "nsAlgorithm.h"
65
#include "nsAlgorithm.h"
65
#include "nsContentUtils.h"
66
#include "nsContentUtils.h"
66
#include "nsDOMClassInfo.h"
67
#include "nsDOMClassInfo.h"
67
#include "nsDOMJSUtils.h"
68
#include "nsDOMJSUtils.h"
68
#include "nsGUIEvent.h"
69
#include "nsGUIEvent.h"
69
#include "nsJSEnvironment.h"
70
#include "nsJSEnvironment.h"
70
#include "nsJSUtils.h"
71
#include "nsJSUtils.h"
71
#include "nsNetUtil.h"
72
#include "nsNetUtil.h"
73
#include "nsSandboxFlags.h"
72
#include "nsThreadUtils.h"
74
#include "nsThreadUtils.h"
73
#include "xpcpublic.h"
75
#include "xpcpublic.h"
74
76
75
#ifdef ANDROID
77
#ifdef ANDROID
76
#include <android/log.h>
78
#include <android/log.h>
77
#endif
79
#endif
78
80
79
#include "Events.h"
81
#include "Events.h"
 Lines 2534-2549   WorkerPrivate::Create(JSContext* aCx, JS Link Here 
2534
          JS_ReportError(aCx, "Could not determine if codebase is file!");
2536
          JS_ReportError(aCx, "Could not determine if codebase is file!");
2535
          return nsnull;
2537
          return nsnull;
2536
        }
2538
        }
2537
2539
2538
        if (isFile) {
2540
        if (isFile) {
2539
          // XXX Fix this, need a real domain here.
2541
          // XXX Fix this, need a real domain here.
2540
          domain = file;
2542
          domain = file;
2541
        }
2543
        }
2544
        // Workaround for workers needing a string domain - will be fixed
2545
        // in a followup after this lands.
2546
        else if (document->SandboxFlags() & SANDBOXED_ORIGIN) {
2547
          if (NS_FAILED(codebase->GetAsciiSpec(domain))) {
2548
            JS_ReportError(aCx, "Could not get URI's spec for sandboxed document!");
2549
            return nsnull;
2550
          }
2551
        }
2542
        else {
2552
        else {
2543
          nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
2553
          nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
2544
            do_GetService(THIRDPARTYUTIL_CONTRACTID);
2554
            do_GetService(THIRDPARTYUTIL_CONTRACTID);
2545
          if (!thirdPartyUtil) {
2555
          if (!thirdPartyUtil) {
2546
            JS_ReportError(aCx, "Could not get third party helper service!");
2556
            JS_ReportError(aCx, "Could not get third party helper service!");
2547
            return nsnull;
2557
            return nsnull;
2548
          }
2558
          }
2549
2559

Return to bug 341604