DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (9fb9a78e2e7e)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
var EXPORTED_SYMBOLS = ["ReftestFissionParent"];

class ReftestFissionParent extends JSWindowActorParent {

  tellChildrenToFlushRendering(browsingContext, ignoreThrottledAnimations) {
    let promises = [];
    this.tellChildrenToFlushRenderingRecursive(browsingContext, ignoreThrottledAnimations, promises);
    return Promise.allSettled(promises);
  }

  tellChildrenToFlushRenderingRecursive(browsingContext, ignoreThrottledAnimations, promises) {
    let cwg = browsingContext.currentWindowGlobal;
    if (cwg && cwg.isProcessRoot) {
      let a = cwg.getActor("ReftestFission");
      if (a) {
        let responsePromise = a.sendQuery("FlushRendering", {ignoreThrottledAnimations});
        promises.push(responsePromise);
      }
    }

    for (let context of browsingContext.getChildren()) {
      this.tellChildrenToFlushRenderingRecursive(context, ignoreThrottledAnimations, promises);
    }
  }

  tellChildrenToUpdateLayerTree(browsingContext) {
    let promises = [];
    this.tellChildrenToUpdateLayerTreeRecursive(browsingContext, promises);
    return Promise.allSettled(promises);
  }

  tellChildrenToUpdateLayerTreeRecursive(browsingContext, promises) {
    let cwg = browsingContext.currentWindowGlobal;
    if (cwg && cwg.isProcessRoot) {
      let a = cwg.getActor("ReftestFission");
      if (a) {
        let responsePromise = a.sendQuery("UpdateLayerTree");
        promises.push(responsePromise);
      }
    }

    for (let context of browsingContext.getChildren()) {
      this.tellChildrenToUpdateLayerTreeRecursive(context, promises);
    }
  }

  receiveMessage(msg) {
    switch (msg.name) {
      case "FlushRendering":
      {
        let promise = this.tellChildrenToFlushRendering(msg.data.browsingContext, msg.data.ignoreThrottledAnimations);
        return promise.then(function (results) {
          let errorStrings = [];
          let warningStrings = [];
          let infoStrings = [];
          for (let r of results) {
            if (r.status != "fulfilled") {
              if (r.status == "pending") {
                errorStrings.push("FlushRendering sendQuery to child promise still pending?");
              } else {
                // We expect actors to go away causing sendQuery's to fail, so
                // just note it.
                infoStrings.push("FlushRendering sendQuery to child promise rejected: " + r.reason);
              }
              continue;
            }

            errorStrings.concat(r.value.errorStrings);
            warningStrings.concat(r.value.warningStrings);
            infoStrings.concat(r.value.infoStrings);
          }
          return {errorStrings, warningStrings, infoStrings};
        });
      }
      case "UpdateLayerTree":
      {
        let promise = this.tellChildrenToUpdateLayerTree(msg.data.browsingContext);
        return promise.then(function (results) {
          let errorStrings = [];
          let infoStrings = [];
          for (let r of results) {
            if (r.status != "fulfilled") {
              if (r.status == "pending") {
                errorStrings.push("UpdateLayerTree sendQuery to child promise still pending?");
              } else {
                // We expect actors to go away causing sendQuery's to fail, so
                // just note it.
                infoStrings.push("UpdateLayerTree sendQuery to child promise rejected: " + r.reason);
              }
              continue;
            }

            if (r.value.errorString != null) {
              errorStrings.push(r.value.errorString);
            }
          }
          return {errorStrings, infoStrings};
        });
      }
    }
  }

}