Browse Source

[RN] Fix remote JS debugging

j8
Lyubo Marinov 8 years ago
parent
commit
aef6e33c91

+ 0
- 1
react/features/app/actions.js View File

43
             domain
43
             domain
44
                 = _parseURIString(state['features/app'].app._getDefaultURL())
44
                 = _parseURIString(state['features/app'].app._getDefaultURL())
45
                     .domain;
45
                     .domain;
46
-
47
         }
46
         }
48
 
47
 
49
         // TODO Kostiantyn Tsaregradskyi: We should probably detect if user is
48
         // TODO Kostiantyn Tsaregradskyi: We should probably detect if user is

+ 16
- 16
react/features/app/components/AbstractApp.js View File

125
         dispatch(appWillUnmount(this));
125
         dispatch(appWillUnmount(this));
126
     }
126
     }
127
 
127
 
128
+    /**
129
+     * Gets a Location object from the window with information about the current
130
+     * location of the document. Explicitly defined to allow extenders to
131
+     * override because React Native does not usually have a location property
132
+     * on its window unless debugging remotely in which case the browser that is
133
+     * the remote debugger will provide a location property on the window.
134
+     *
135
+     * @public
136
+     * @returns {Location} A Location object with information about the current
137
+     * location of the document.
138
+     */
139
+    getWindowLocation() {
140
+        return undefined;
141
+    }
142
+
128
     /**
143
     /**
129
      * Implements React's {@link Component#render()}.
144
      * Implements React's {@link Component#render()}.
130
      *
145
      *
226
         // If the execution environment provides a Location abstraction, then
241
         // If the execution environment provides a Location abstraction, then
227
         // this App at already at that location but it must be made aware of the
242
         // this App at already at that location but it must be made aware of the
228
         // fact.
243
         // fact.
229
-        const windowLocation = this._getWindowLocation();
244
+        const windowLocation = this.getWindowLocation();
230
 
245
 
231
         if (windowLocation) {
246
         if (windowLocation) {
232
             const href = windowLocation.toString();
247
             const href = windowLocation.toString();
272
         return store;
287
         return store;
273
     }
288
     }
274
 
289
 
275
-    /**
276
-     * Gets a Location object from the window with information about the current
277
-     * location of the document. Explicitly defined to allow extenders to
278
-     * override because React Native does not usually have a location property
279
-     * on its window unless debugging remotely in which case the browser that is
280
-     * the remote debugger will provide a location property on the window.
281
-     *
282
-     * @protected
283
-     * @returns {Location} A Location object with information about the current
284
-     * location of the document.
285
-     */
286
-    _getWindowLocation() {
287
-        return undefined;
288
-    }
289
-
290
     /**
290
     /**
291
      * Creates a Redux store to be used by this AbstractApp if such as store is
291
      * Creates a Redux store to be used by this AbstractApp if such as store is
292
      * not defined by the consumer of this AbstractApp through its
292
      * not defined by the consumer of this AbstractApp through its

+ 3
- 3
react/features/app/components/App.web.js View File

52
      *
52
      *
53
      * @inheritdoc
53
      * @inheritdoc
54
      */
54
      */
55
-    _getWindowLocation() {
55
+    getWindowLocation() {
56
         return window.location;
56
         return window.location;
57
     }
57
     }
58
 
58
 
63
      * @returns {string} The context root of window.location i.e. this Web App.
63
      * @returns {string} The context root of window.location i.e. this Web App.
64
      */
64
      */
65
     _getWindowLocationContextRoot() {
65
     _getWindowLocationContextRoot() {
66
-        const pathname = this._getWindowLocation().pathname;
66
+        const pathname = this.getWindowLocation().pathname;
67
         const contextRootEndIndex = pathname.lastIndexOf('/');
67
         const contextRootEndIndex = pathname.lastIndexOf('/');
68
 
68
 
69
         return (
69
         return (
93
         path = this._routePath2WindowLocationPathname(path);
93
         path = this._routePath2WindowLocationPathname(path);
94
 
94
 
95
         // Navigate to the specified Route.
95
         // Navigate to the specified Route.
96
-        const windowLocation = this._getWindowLocation();
96
+        const windowLocation = this.getWindowLocation();
97
 
97
 
98
         if (windowLocation.pathname === path) {
98
         if (windowLocation.pathname === path) {
99
             // The browser is at the specified path already and what remains is
99
             // The browser is at the specified path already and what remains is

+ 2
- 1
react/features/unsupported-browser/middleware.js View File

40
     // execution enviroment has changed. The current location is not necessarily
40
     // execution enviroment has changed. The current location is not necessarily
41
     // available through window.location (e.g. on mobile) but the following
41
     // available through window.location (e.g. on mobile) but the following
42
     // works at the time of this writing.
42
     // works at the time of this writing.
43
-    const windowLocation = window.location;
43
+    const windowLocation
44
+        = store.getState()['features/app'].app.getWindowLocation();
44
 
45
 
45
     if (windowLocation) {
46
     if (windowLocation) {
46
         const href = windowLocation.href;
47
         const href = windowLocation.href;

Loading…
Cancel
Save