Explorar el Código

[RN] Fix remote JS debugging

j8
Lyubo Marinov hace 8 años
padre
commit
aef6e33c91

+ 0
- 1
react/features/app/actions.js Ver fichero

@@ -43,7 +43,6 @@ export function appNavigate(uri) {
43 43
             domain
44 44
                 = _parseURIString(state['features/app'].app._getDefaultURL())
45 45
                     .domain;
46
-
47 46
         }
48 47
 
49 48
         // TODO Kostiantyn Tsaregradskyi: We should probably detect if user is

+ 16
- 16
react/features/app/components/AbstractApp.js Ver fichero

@@ -125,6 +125,21 @@ export class AbstractApp extends Component {
125 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 144
      * Implements React's {@link Component#render()}.
130 145
      *
@@ -226,7 +241,7 @@ export class AbstractApp extends Component {
226 241
         // If the execution environment provides a Location abstraction, then
227 242
         // this App at already at that location but it must be made aware of the
228 243
         // fact.
229
-        const windowLocation = this._getWindowLocation();
244
+        const windowLocation = this.getWindowLocation();
230 245
 
231 246
         if (windowLocation) {
232 247
             const href = windowLocation.toString();
@@ -272,21 +287,6 @@ export class AbstractApp extends Component {
272 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 291
      * Creates a Redux store to be used by this AbstractApp if such as store is
292 292
      * not defined by the consumer of this AbstractApp through its

+ 3
- 3
react/features/app/components/App.web.js Ver fichero

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

+ 2
- 1
react/features/unsupported-browser/middleware.js Ver fichero

@@ -40,7 +40,8 @@ function _setWebRTCReady(store, next, action) {
40 40
     // execution enviroment has changed. The current location is not necessarily
41 41
     // available through window.location (e.g. on mobile) but the following
42 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 46
     if (windowLocation) {
46 47
         const href = windowLocation.href;

Loading…
Cancelar
Guardar